//create a new workbook var workbook = new GrapeCity.Documents.Excel.Workbook(); var worksheet = workbook.Worksheets[0]; worksheet.Name = "Horizontal"; worksheet.Range["A1"].Value = "A salesman's incomings and outgoings"; worksheet.Range["A2:B8"].Value = new object[,] { { "Salary", 3500 }, { "Performance pay", 2500 }, { "Pay for customers", -1000 }, { "Board expenses", -1000 }, { "Chummage", -900 }, { "Financial management", 300 }, { "Deposit", 3400 } }; worksheet.Range["1:11"].RowHeight = 20; worksheet.Range["A1"].ColumnWidth = 20; worksheet.Range["B1"].ColumnWidth = 15; worksheet.Range["C1"].ColumnWidth = 40; worksheet.Range["A1:C1"].Merge(); worksheet.Range["A1"].HorizontalAlignment = HorizontalAlignment.Center; worksheet.Range["A1"].Interior.Color = System.Drawing.Color.Purple; worksheet.Range["A1"].Font.Color = System.Drawing.Color.White; worksheet.Range["A1"].Font.Size = 15; worksheet.Range["A1"].Font.Bold = true; // Add a cascade sparkline with horizontal bars. for (int i = 1; i < 8; i++) { worksheet.Range[i, 2].Formula = "=CASCADESPARKLINE(B2:B8, ROW() - 1, A2:A8, , , \"#8CBF64\", \"#D6604D\", FALSE)"; } var worksheet_vertical = workbook.Worksheets.Add(); worksheet_vertical.Name = "Vertical"; worksheet_vertical.Range["A1"].Value = "Inventory Audit"; worksheet_vertical.Range["A2:E3"].Value = new object[,] { { "Stock", "Damaged", "Refurbished", "Returns", "Salable Units" }, { 790, -220, 170, 83, 823} }; worksheet_vertical.Range["A1:E1"].Merge(); worksheet_vertical.Range["A1"].HorizontalAlignment = HorizontalAlignment.Center; worksheet_vertical.Range["A1"].Interior.Color = System.Drawing.Color.Gray; worksheet_vertical.Range["A1"].Font.Color = System.Drawing.Color.White; worksheet_vertical.Range["A1"].Font.Size = 15; worksheet_vertical.Range["A1:A3"].Font.Bold = true; worksheet_vertical.Range["E2:E3"].Font.Bold = true; worksheet_vertical.Range["1:1"].RowHeight = 20; worksheet_vertical.Range["4:4"].RowHeight = 200; worksheet_vertical.Range["A:E"].ColumnWidth = 14; // Add a cascade sparkline with vertical bars. for (int i = 0; i < 5; i++) { worksheet_vertical.Range[3, i].Formula = "=CASCADESPARKLINE($A$3:$E$3, COLUMN(), $A$2:$E$2, , , \"#8CBF64\", \"#D6604D\", true)"; } // Save to a pdf file workbook.Save("CascadeSparkline.pdf");
' Create a new Workbook Dim workbook As New Workbook Dim worksheet = workbook.Worksheets(0) worksheet.Name = "Horizontal" worksheet.Range("A1").Value = "A salesman's incomings and outgoings" Dim data As Object(,) = { {"Salary", 3500}, {"Performance pay", 2500}, {"Pay for customers", -1000}, {"Board expenses", -1000}, {"Chummage", -900}, {"Financial management", 300}, {"Deposit", 3400} } worksheet.Range("A2:B8").Value = data worksheet.Range("1:11").RowHeight = 20 worksheet.Range("A1").ColumnWidth = 20 worksheet.Range("B1").ColumnWidth = 15 worksheet.Range("C1").ColumnWidth = 40 worksheet.Range("A1:C1").Merge() worksheet.Range("A1").HorizontalAlignment = HorizontalAlignment.Center worksheet.Range("A1").Interior.Color = System.Drawing.Color.Purple worksheet.Range("A1").Font.Color = System.Drawing.Color.White worksheet.Range("A1").Font.Size = 15 worksheet.Range("A1").Font.Bold = True 'Add a cascade sparkline with horizontal bars. For i = 1 To 7 worksheet.Range(i, 2).Formula = "=CASCADESPARKLINE(B2:B8, ROW() - 1, A2:A8, , , ""#8CBF64"", ""#D6604D"", FALSE)" Next Dim worksheet_vertical = workbook.Worksheets.Add() worksheet_vertical.Name = "Vertical" worksheet_vertical.Range("A1").Value = "Inventory Audit" Dim data2 As Object(,) = { {"Stock", "Damaged", "Refurbished", "Returns", "Salable Units"}, {790, -220, 170, 83, 823} } worksheet_vertical.Range("A2:E3").Value = data2 worksheet_vertical.Range("A1:E1").Merge() worksheet_vertical.Range("A1").HorizontalAlignment = HorizontalAlignment.Center worksheet_vertical.Range("A1").Interior.Color = System.Drawing.Color.Gray worksheet_vertical.Range("A1").Font.Color = System.Drawing.Color.White worksheet_vertical.Range("A1").Font.Size = 15 worksheet_vertical.Range("A1:A3").Font.Bold = True worksheet_vertical.Range("E2:E3").Font.Bold = True worksheet_vertical.Range("1:1").RowHeight = 20 worksheet_vertical.Range("4:4").RowHeight = 200 worksheet_vertical.Range("A:E").ColumnWidth = 14 'Add a cascade sparkline with vertical bars. For i = 0 To 4 worksheet_vertical.Range(3, i).Formula = "=CASCADESPARKLINE($A$3:$E$3, COLUMN(), $A$2:$E$2, , , ""#8CBF64"", ""#D6604D"", true)" Next ' save to a pdf file workbook.Save("CascadeSparkline.pdf")