// 新規ワークブックの作成 var workbook = new GrapeCity.Documents.Excel.Workbook(); Stream openStream = GetResourceStream("xlsx\\TemplateWorkWithChart.xlsx"); workbook.Open(openStream, OpenFileFormat.Xlsx); IWorksheet worksheet = workbook.Worksheets[0]; IShape shape1 = worksheet.Shapes.AddShape(AutoShapeType.RoundedRectangle, (double)10, (double)10, (double)320, (double)150); shape1.TextFrame.TextRange.TextAlignment = TextAlignmentAnchor.Left; shape1.TextFrame.TextRange.Font.Name = "MS ゴシック"; shape1.TextFrame.TextRange.Font.Size = 16; shape1.TextFrame.TextRange.Font.Color.RGB = Color.Black; shape1.TextFrame.TextRange.Font.Underline = TextUnderlineType.None; shape1.TextFrame.TextRange.Paragraphs.Add("四半期ごとの業績"); shape1.TextFrame.TextRange.Paragraphs[0].TextAlignment = TextAlignmentAnchor.Center; shape1.TextFrame.TextRange.Paragraphs[0].Font.Size = 28; shape1.TextFrame.TextRange.Paragraphs[0].Font.Underline = TextUnderlineType.Single; shape1.TextFrame.TextRange.Paragraphs.Add(""); shape1.TextFrame.TextRange.Paragraphs.Add("事業名:Eコマース"); shape1.TextFrame.TextRange.Paragraphs[2].TextAlignment = TextAlignmentAnchor.Left; shape1.TextFrame.TextRange.Paragraphs.Add("期:第4四半期"); shape1.TextFrame.TextRange.Paragraphs[3].TextAlignment = TextAlignmentAnchor.Left; shape1.Line.DashStyle = LineDashStyle.Solid; shape1.Line.Style = LineStyle.Single; shape1.Line.Color.RGB = Color.Black; shape1.Fill.Color.RGB = Color.FromArgb(242, 242, 242); // xlsx ファイルに保存 workbook.Save("UseCaseOfShapeTextAlignment.xlsx");
' 新規ワークブックの作成 Dim workbook As New Workbook Dim openStream As Stream = GetResourceStream("xlsx\TemplateWorkWithChart.xlsx") workbook.Open(openStream, OpenFileFormat.Xlsx) Dim worksheet As IWorksheet = workbook.Worksheets(0) Dim shape1 As IShape = worksheet.Shapes.AddShape(AutoShapeType.RoundedRectangle, CDbl(10), CDbl(10), CDbl(320), CDbl(150)) shape1.TextFrame.TextRange.TextAlignment = TextAlignmentAnchor.Left shape1.TextFrame.TextRange.Font.Name = "MS ゴシック" shape1.TextFrame.TextRange.Font.Size = 16 shape1.TextFrame.TextRange.Font.Color.RGB = System.Drawing.Color.Black shape1.TextFrame.TextRange.Font.Underline = TextUnderlineType.None shape1.TextFrame.TextRange.Paragraphs.Add("四半期ごとの業績") shape1.TextFrame.TextRange.Paragraphs(0).TextAlignment = TextAlignmentAnchor.Center shape1.TextFrame.TextRange.Paragraphs(0).Font.Size = 28 shape1.TextFrame.TextRange.Paragraphs(0).Font.Underline = TextUnderlineType.Single shape1.TextFrame.TextRange.Paragraphs.Add("") shape1.TextFrame.TextRange.Paragraphs.Add("事業名:Eコマース") shape1.TextFrame.TextRange.Paragraphs(2).TextAlignment = TextAlignmentAnchor.Left shape1.TextFrame.TextRange.Paragraphs.Add("期:第4四半期") shape1.TextFrame.TextRange.Paragraphs(3).TextAlignment = TextAlignmentAnchor.Left shape1.Line.DashStyle = LineDashStyle.Solid shape1.Line.Style = LineStyle.Single shape1.Line.Color.RGB = System.Drawing.Color.Black shape1.Fill.Color.RGB = System.Drawing.Color.FromArgb(242, 242, 242) ' xlsx ファイルに保存 workbook.Save("UseCaseOfShapeTextAlignment.xlsx")