I am using EPPlus. I am stuck at cell formulas.
My code is below:
ExcelPackage pck = new ExcelPackage(@"D:\MYSheets\EmptyFile.xlsx"); var ws = pck.Workbook.Worksheets["MySheet"]; ws.Cells["A3"].Value = "2.3"; ws.Cells["A4"].Value = "10.2"; ws.Cells["A5"].Formula = "=SUM(A3:A4)"; ws.Cells["A5"].Style.Numberformat.Format = "#,##0.00"; pck.Save();
When I open Excel, by default, A5 cell is not calculating the sum of A3 and A4. Unless I modify the A3 and/or A4 cells, the A5 cell remains not calculated.
I tried using the following code but it didn't work for me:
ws.Workbook.CalcMode = ExcelCalcMode.Automatic;