//create a new workbook var workbook = new GrapeCity.Documents.Excel.Workbook(); var worksheet = workbook.ActiveSheet; worksheet.Range["A1"].Value = "Sales Data"; worksheet.Range["A2:F6"].Value = new object[,] { {"Salesperson","Jan","Feb","Mar","Apr","May"}, {"Courtney Graves",76000,68250,72000,99750,45500}, {"Crystal Cross",118750,89250,121250,92500,60750}, {"Jodi Hall",75500,56500,65500,62750,77500}, {"Andrew James",76750,108500,88000,55750,106000} }; worksheet.Range["G2"].Value = "SparkLine"; worksheet.Range["G3:G6"].Formula = "=COLUMNSPARKLINE(B3:F3,1,,,\"{showMarkers:TRUE}\")"; worksheet.Range["A1:G1"].Merge(); worksheet.Range["A1"].Interior.Color = System.Drawing.Color.Purple; worksheet.Range["A1"].Font.Color = System.Drawing.Color.White; worksheet.Range["A1"].HorizontalAlignment = HorizontalAlignment.Center; worksheet.Range["A1:G6"].Borders.LineStyle = BorderLineStyle.Thin; worksheet.Range["B3:F6"].NumberFormat = "$#,##0"; worksheet.Range["A1:G2"].Font.Bold = true; worksheet.Range["A1"].Font.Size = 15; worksheet.Range["A2:G6"].Font.Size = 13; worksheet.Range["A:F"].AutoFit(); worksheet.Range["1:6"].RowHeight = 25; worksheet.Range["G1"].ColumnWidth = 30; worksheet.PageSetup.Orientation = PageOrientation.Landscape;
' Create a new Workbook Dim workbook As New Workbook Dim worksheet = workbook.ActiveSheet worksheet.Range("A1").Value = "Sales Data" worksheet.Range("A2:F6").Value = New Object(,) { {"Salesperson","Jan","Feb","Mar","Apr","May"}, {"Courtney Graves",76000,68250,72000,99750,45500}, {"Crystal Cross",118750,89250,121250,92500,60750}, {"Jodi Hall",75500,56500,65500,62750,77500}, {"Andrew James",76750,108500,88000,55750,106000} } worksheet.Range("G2").Value = "SparkLine" worksheet.Range("G3:G6").Formula = "=COLUMNSPARKLINE(B3:F3,1,,,""{showMarkers:TRUE}"")" worksheet.Range("A1:G1").Merge() worksheet.Range("A1").Interior.Color = System.Drawing.Color.Purple worksheet.Range("A1").Font.Color = System.Drawing.Color.White worksheet.Range("A1").HorizontalAlignment = HorizontalAlignment.Center worksheet.Range("A1:G6").Borders.LineStyle = BorderLineStyle.Thin worksheet.Range("B3:F6").NumberFormat = "$#,##0" worksheet.Range("A1:G2").Font.Bold = True worksheet.Range("A1").Font.Size = 15 worksheet.Range("A2:G6").Font.Size = 13 worksheet.Range("A:F").AutoFit() worksheet.Range("1:6").RowHeight = 25 worksheet.Range("G1").ColumnWidth = 30 worksheet.PageSetup.Orientation = PageOrientation.Landscape ' save to a pdf file workbook.Save("ColumnSparkline.pdf")