// 新規ワークブックの作成 var workbook = new GrapeCity.Documents.Excel.Workbook(); object[,] data = new object[,] { {"番号", "日付", "顧客", "適用", "傾向", "0-30 日間", "30-60 日間", "60-90 日間", "90 日以上", "実績"}, {"1001", new DateTime(2017, 5, 21), "取引先 A", "請求書 1001", null, 1200.15, 1916.18, 1105.23, 1806.53, null}, {"1002", new DateTime(2017, 3, 18), "取引先 B", "請求書 1002", null, 896.23, 1005.53, 1800.56, 1150.49, null}, {"1003", new DateTime(2017, 6, 15), "取引先 C", "請求書 1003", null, 827.63, 1009.23, 1869.23, 1002.56, null} }; IWorksheet worksheet = workbook.Worksheets[0]; worksheet.Range["B2:K5"].Value = data; worksheet.Range["B:K"].ColumnWidth = 15; worksheet.Tables.Add(worksheet.Range["B2:K5"], true); worksheet.Tables[0].Columns[9].DataBodyRange.Formula = "=SUM(Table1[@[0-30 日間]:[90 日以上]])"; // 新しいスパークライングループを作成 worksheet.Range["F3:F5"].SparklineGroups.Add(SparkType.Line, "G3:J5"); var sparklinegroup = worksheet.Range["F3"].SparklineGroups[0]; // スパークラインを設定 sparklinegroup.LineWeight = 2.5; sparklinegroup.Points.Markers.Color.ThemeColor = ThemeColor.Accent2; sparklinegroup.Points.Markers.Visible = true; sparklinegroup.SeriesColor.ThemeColor = ThemeColor.Accent6; // xlsx ファイルに保存 workbook.Save("ConfigSparklineSettings.xlsx");
' 新規ワークブックの作成 Dim workbook As New Workbook Dim data As Object(,) = { {"番号", "日付", "顧客", "適用", "傾向", "0-30 日間", "30-60 日間", "60-90 日間", "90 日以上", "実績"}, {"1001", #5/21/2017#, "取引先 A", "請求書 1001", Nothing, 1200.15, 1916.18, 1105.23, 1806.53, Nothing}, {"1002", #3/18/2017#, "取引先 B", "請求書 1002", Nothing, 896.23, 1005.53, 1800.56, 1150.49, Nothing}, {"1003", #6/15/2017#, "取引先 C", "請求書 1003", Nothing, 827.63, 1009.23, 1869.23, 1002.56, Nothing} } Dim worksheet As IWorksheet = workbook.Worksheets(0) worksheet.Range("B2:K5").Value = data worksheet.Range("B:K").ColumnWidth = 15 worksheet.Tables.Add(worksheet.Range("B2:K5"), True) worksheet.Tables(0).Columns(9).DataBodyRange.Formula = "=SUM(Table1[@[0-30 日間]:[90 日以上]])" ' 新しいスパークライングループを作成 worksheet.Range("F3:F5").SparklineGroups.Add(SparkType.Line, "G3:J5") Dim sparklinegroup = worksheet.Range!F3.SparklineGroups(0) ' スパークラインを設定 sparklinegroup.LineWeight = 2.5 sparklinegroup.Points.Markers.Color.ThemeColor = ThemeColor.Accent2 sparklinegroup.Points.Markers.Visible = True sparklinegroup.SeriesColor.ThemeColor = ThemeColor.Accent6 ' xlsx ファイルに保存 workbook.Save("ConfigSparklineSettings.xlsx")