// 新規ワークブックの作成 var workbook = new GrapeCity.Documents.Excel.Workbook(); IWorksheet worksheet = workbook.Worksheets[0]; Drawing.IShapes shapes = worksheet.Shapes; Drawing.IShape pentagon = shapes.AddShape(Drawing.AutoShapeType.RegularPentagon, 89.4, 57.0, 153.6, 90.6); Drawing.IShape pie = shapes.AddShape(Drawing.AutoShapeType.Pie, 344.4, 156.8, 50.4, 60.0); Drawing.IShapeRange shpRange = shapes.Range[new[] { pentagon.Name, pie.Name }]; // 図形の範囲をグループ化 Drawing.IShape grouped = shpRange.Group(); grouped.Line.Visible = true; grouped.Line.Color.RGB = System.Drawing.Color.Orange; grouped.Fill.Color.RGB = System.Drawing.Color.OrangeRed; // xlsx ファイルに保存 workbook.Save("ShapeGroup.xlsx");
' 新規ワークブックの作成 Dim workbook As New Workbook Dim worksheet As IWorksheet = workbook.Worksheets(0) Dim shapes As IShapes = worksheet.Shapes Dim pentagon As IShape = shapes.AddShape(AutoShapeType.RegularPentagon, 89.4, 57.0, 153.6, 90.6) Dim pie As IShape = shapes.AddShape(AutoShapeType.Pie, 344.4, 156.8, 50.4, 60.0) Dim shpRange As IShapeRange = shapes.Range({pentagon.Name, pie.Name}) ' 図形の範囲をグループ化 Dim grouped As IShape = shpRange.Group() With grouped.Line .Visible = True .Color.RGB = System.Drawing.Color.Orange .Color.RGB = System.Drawing.Color.OrangeRed End With ' xlsx ファイルに保存 workbook.Save("ShapeGroup.xlsx")