...
Code Block | ||||
---|---|---|---|---|
| ||||
//--- Create ExcelApplication, a Workbook, and a Worksheet ExcelApplication xlw = new ExcelApplication(ExcelApplication.FileFormat.Xlsx); Workbook wb = xlw.Create(); Worksheet sheet1 = wb.Worksheets[0]; //--- Write some values into cells for the //--- formulas to compute sheet1.Cells["A1"].Value = 1; sheet1.Cells["A2"].Value = 2; sheet1.Cells["A3"].Value = 3; //--- Write a formula into a cell //--- Formula will be calculated //--- when opened in Excel sheet1.Cells["A4"].Formula = "=SUM(A1:A3)"; //--- Save the workbook xlw.Save(wb, "Generated.xlsx"); |
Code Sample
This sample shows many of the core features of ExcelApplication, including the use of formulas.
...