Thanks for the screen shots.
Well, as per your screen shot, you are doing calculating formulas for a worksheet/range of cells by using VBA codes in MS Excel.
Well, we have further evaluated and I think we already provide this feature (Calculate Formulas for a Worksheet only), please check this overloaded method of Worksheet.CalculateFormula(), here is the complete description:
public void CalculateFormula(
bool recursive ,
bool ignoreError ,
- True means if the worksheet' cells depend on the cells of other worksheets,
the dependent cells in other worksheets will be calculated too. False means all
the formulas in the worksheet have been calculated and the values are right.
- Indicates if hide the error in calculating formulas. The error may be
unsupported function, external links, etc.
- The custom formula calculation functions to extend the calculation
I have written a simple example for you here too. Please put null for the last parameter if you do not have any custom function.
//Create a workbook
Workbook workbook = new Workbook();
//Access first worksheet
Worksheet worksheet = workbook.Worksheets;
//Put 20 in cell A1
Cell cellA1 = worksheet.Cells["A1"];
//Put 30 in cell A2
Cell cellA2 = worksheet.Cells["A2"];
//Specify formula on A3
Cell cellA3 = worksheet.Cells["A3"];
cellA3.Formula = "=Sum(A1:A2)";
int val = cellA3.IntValue;
MessageBox.Show("Calculated Value: " + val.ToString()); //50 - OK
Please try this overload and let me know how it goes related to performance.
If you still have any performance issue, kindly give us more details, e.g sample project, Excel files, screen shots etc. We will check your issue soon.