//create a new workbook var workbook = new GrapeCity.Documents.Excel.Workbook(); //Load template file Financial KPIs.xlsx from resource var fileStream = this.GetResourceStream("xlsx\\Financial KPIs.xlsx"); workbook.Open(fileStream); var worksheet = workbook.ActiveSheet; //set values object[,] ProData = new object[,] { {1483550,121386 }, {0.4336,0.32 }, {0.1236,-0.0438 }, {12.36,-0.0438 } }; object[] ProData1 = new object[] { 0.14,0.0029,0.0361,0.0361 }; worksheet.Range["E7:F10"].Value = ProData; worksheet.Range["I7:I10"].Value = ProData1; object[,] ActiveData = new object[,] { {"4.32 item","2.00 item" }, {"72 days","45 days" }, {"53 days","55 days" } }; object[] ActiveData1 = new object[] { "0.45 items","-5 days","-6 days" }; worksheet.Range["E12:F14"].Value = ActiveData; worksheet.Range["I12:I14"].Value = ActiveData1; object[,] EffData = new object[,] { {0.3446,0.25 }, {0.5335,0.11 } }; object[] EffData1 = new object[] { 0.1245,0.1946 }; worksheet.Range["E16:F17"].Value = EffData; worksheet.Range["I16:I17"].Value = EffData1; object[,] LinData = new object[,] { {"0.91:1","'2:1" }, {"0.58:1","'1:1" } }; object[] LinData1 = new object[] { "'0.02:1","'0.03:1" }; worksheet.Range["E19:F20"].Value = LinData; worksheet.Range["I19:I20"].Value = LinData1; object[,] GeaData = new object[,] { {-9.60,0.85 }, {0.68,0.5 } }; object[] GeaData1 = new object[] { 6.65,0.0282 }; worksheet.Range["E22:F23"].Value = GeaData; worksheet.Range["I22:I23"].Value = GeaData1; object[,] CasData = new object[,] { {0.0735,1.2 }, {0.1442,0.1442 } }; object[] CasData1 = new object[] { -0.0046,0.023 }; worksheet.Range["E25:F26"].Value = CasData; worksheet.Range["I25:I26"].Value = CasData1; // Save to an excel file workbook.Save("FinancialKPIs.xlsx");
' Create a new Workbook Dim workbook As New Workbook 'Load template file Financial KPIs.xlsx from resource Dim fileStream = GetResourceStream("Financial KPIs.xlsx") workbook.Open(fileStream) Dim worksheet = workbook.ActiveSheet 'set values Dim ProData(,) As Object = { {1483550, 121386}, {0.4336, 0.32}, {0.1236, -0.0438}, {12.36, -0.0438} } Dim ProData1() As Object = {0.14, 0.0029, 0.0361, 0.0361} worksheet.Range("E7:F10").Value = ProData worksheet.Range("I7:I10").Value = ProData1 Dim ActiveData(,) As Object = { {"4.32 item", "2.00 item"}, {"72 days", "45 days"}, {"53 days", "55 days"} } Dim ActiveData1() As Object = {"0.45 items", "-5 days", "-6 days"} worksheet.Range("E12:F14").Value = ActiveData worksheet.Range("I12:I14").Value = ActiveData1 Dim EffData(,) As Object = { {0.3446, 0.25}, {0.5335, 0.11} } Dim EffData1() As Object = {0.1245, 0.1946} worksheet.Range("E16:F17").Value = EffData worksheet.Range("I16:I17").Value = EffData1 Dim LinData(,) As Object = { {"0.91:1", "'2:1"}, {"0.58:1", "'1:1"} } Dim LinData1() As Object = {"'0.02:1", "'0.03:1"} worksheet.Range("E19:F20").Value = LinData worksheet.Range("I19:I20").Value = LinData1 Dim GeaData(,) As Object = { {-9.6, 0.85}, {0.68, 0.5} } Dim GeaData1() As Object = {6.65, 0.0282} worksheet.Range("E22:F23").Value = GeaData worksheet.Range("I22:I23").Value = GeaData1 Dim CasData(,) As Object = { {0.0735, 1.2}, {0.1442, 0.1442} } Dim CasData1() As Object = {-0.0046, 0.023} worksheet.Range("E25:F26").Value = CasData worksheet.Range("I25:I26").Value = CasData1 ' save to an excel file workbook.Save("FinancialKPIs.xlsx")