EPPlus Formula Evaluation

2019-09-15 11:12发布

When using EPPlus, I am trying to insert the result of a formula into a cell

ie:

Worksheet.Cells["A4"].Value = 3
Worksheet.Cells["A5"].Value = 4
Worksheet.Cells["A6"].Formula = "=SUM(A3:A4)"
Worksheet.Cells["A6"].Calculate()

In the worksheet i will see the formula in the Formula bar, but what I would like is to evaluate the formula in EPPlus and insert the value into the cell. So when clicking into the cell all i see is 7 and not =SUM(A3:A4)

The reason for this, is because I have large worksheet (for business reasons) and having the formulas calculate when opening means the sheet takes about 20 seconds to load

标签: c# excel epplus
2条回答
放荡不羁爱自由
2楼-- · 2019-09-15 11:53

just to illustrate swmal answer :

epplus calculate

查看更多
淡お忘
3楼-- · 2019-09-15 11:55

If you want to calculate and remove the actual formula before you send the workbook to the client you should set the Formula property to string.Empty after you have called Calculate(). The calculated value is stored in the Value property of the cell.

查看更多
登录 后发表回答