Reputation: 125
I need some help.
I have this very simple code: http://pastebin.com/xc9xNHLQ
The issue I'm having is that every time I open the spreadsheet and try to close it, I'm being asked to save changes without making any changes.
I know the issue is in the SUM formula but is there a way of disabling that?
Using EPPLU and Studio 2015
Thanks
Upvotes: 0
Views: 2540
Reputation: 50
must using
package.Workbook.CalcMode = ExcelCalcMode.Manual;
and for calculating manually call:
package.Workbook.Calculate();
UPDATE: from comment of 'Charles Mager' and this post, you can set FullCalcOnLoad to false then calculate manually. this is your manipulated sample code:
package.Workbook.FullCalcOnLoad = false;
worksheet.Cells[RowNumber, 2].Value = "Total:";
worksheet.Cells[RowNumber, 3].Formula = "SUM(C12:C" + (RowNumber - 1) + ")";
worksheet.Cells[RowNumber, 2, RowNumber, 3].Style.Font.Name = "Arial";
worksheet.Cells[RowNumber, 2, RowNumber, 3].Style.Font.Size = 12;
worksheet.Cells[RowNumber, 2, RowNumber, 3].Style.Font.Bold = true;
worksheet.Row(RowNumber).Height = 20;
worksheet.Cells[RowNumber, 2, RowNumber, 3].Style.Border.Right.Style = ExcelBorderStyle.Thin;
worksheet.Calculate();
package.Save();
Upvotes: 1