//create a new workbook var workbook = new GrapeCity.Documents.Excel.Workbook(); object[,] data = new object[,] { {"Number", "Date", "Customer", "Description", "Trend", "0-30 Days", "30-60 Days", "60-90 Days", ">90 Days", "Amount"}, {"1001", new DateTime(2017, 5, 21), "Customer A", "Invoice 1001", null, 1200.15, 1916.18, 1105.23, 1806.53, null}, {"1002", new DateTime(2017, 3, 18), "Customer B", "Invoice 1002", null, 896.23, 1005.53, 1800.56, 1150.49, null}, {"1003", new DateTime(2017, 6, 15), "Customer C", "Invoice 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 Days]:[>90 Days]])"; //create a new group of sparklines. worksheet.Range["F3:F5"].SparklineGroups.Add(SparkType.Line, "G3:J5"); var sparklinegroup = worksheet.Range["F3"].SparklineGroups[0]; //Config sparkline settings. sparklinegroup.LineWeight = 2.5; sparklinegroup.Points.Markers.Color.ThemeColor = ThemeColor.Accent2; sparklinegroup.Points.Markers.Visible = true; sparklinegroup.SeriesColor.ThemeColor = ThemeColor.Accent6;
' Create a new Workbook Dim workbook As New Workbook Dim data As Object(,) = { {"Number", "Date", "Customer", "Description", "Trend", "0-30 Days", "30-60 Days", "60-90 Days", ">90 Days", "Amount"}, {"1001", #5/21/2017#, "Customer A", "Invoice 1001", Nothing, 1200.15, 1916.18, 1105.23, 1806.53, Nothing}, {"1002", #3/18/2017#, "Customer B", "Invoice 1002", Nothing, 896.23, 1005.53, 1800.56, 1150.49, Nothing}, {"1003", #6/15/2017#, "Customer C", "Invoice 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 Days]:[>90 Days]])" 'create a new group of sparklines. worksheet.Range("F3:F5").SparklineGroups.Add(SparkType.Line, "G3:J5") Dim sparklinegroup = worksheet.Range!F3.SparklineGroups(0) 'Config sparkline settings. sparklinegroup.LineWeight = 2.5 sparklinegroup.Points.Markers.Color.ThemeColor = ThemeColor.Accent2 sparklinegroup.Points.Markers.Visible = True sparklinegroup.SeriesColor.ThemeColor = ThemeColor.Accent6 ' save to an excel file workbook.Save("ConfigSparklineSettings.xlsx")