手動計算

如果使用公式,Excel 將要求你每次儲存檔案,即使沒有進行任何更改。要防止此行為,你可以將計算模式設定為手動。

excelPackage.Workbook.CalcMode = ExcelCalcMode.Manual;

//fill the sheet with data and set the formulas

excelPackage.Workbook.Calculate();