// 新規ワークブックの作成 var workbook = new GrapeCity.Documents.Excel.Workbook(); IWorksheet worksheet = workbook.Worksheets[0]; IShapes shapes = worksheet.Shapes; IShape rectangle = shapes.AddShape(AutoShapeType.Rectangle, 20, 20, 100, 100); rectangle.Fill.Color.RGB = System.Drawing.Color.FromArgb(169, 209, 142); IShape oval = shapes.AddShape(AutoShapeType.Oval, 50, 50, 100, 100); oval.Fill.Color.RGB = System.Drawing.Color.FromArgb(157, 195, 230); IShape triangle = shapes.AddShape(AutoShapeType.IsoscelesTriangle, 80, 80, 100, 100); triangle.Fill.Color.RGB = System.Drawing.Color.FromArgb(255, 230, 153); // 長方形が楕円形の上になるよう設定 rectangle.ZOrder(ZOrderType.BringForward); // 三角形が最背面になるよう設定 triangle.ZOrder(ZOrderType.SendToBack); // xlsx ファイルに保存 workbook.Save("SetShapeZOrder.xlsx");
' 新規ワークブックの作成 Dim workbook As New Workbook Dim worksheet As IWorksheet = workbook.Worksheets(0) Dim shapes As IShapes = worksheet.Shapes Dim rectangle As IShape = shapes.AddShape(AutoShapeType.Rectangle, 20, 20, 100, 100) rectangle.Fill.Color.RGB = System.Drawing.Color.FromArgb(169, 209, 142) Dim oval As IShape = shapes.AddShape(AutoShapeType.Oval, 50, 50, 100, 100) oval.Fill.Color.RGB = System.Drawing.Color.FromArgb(157, 195, 230) Dim triangle As IShape = shapes.AddShape(AutoShapeType.IsoscelesTriangle, 80, 80, 100, 100) triangle.Fill.Color.RGB = System.Drawing.Color.FromArgb(255, 230, 153) ' 長方形が楕円形の上になるよう設定 rectangle.ZOrder(ZOrderType.BringForward) ' 三角形が最背面になるよう設定 triangle.ZOrder(ZOrderType.SendToBack) ' xlsx ファイルに保存 workbook.Save("SetShapeZOrder.xlsx")