Cells Calculation Engine

We are using Aspose.Cells strictly as a calculation engine. Writing and reading the cells are very fast, but loading and calculate portions seems lacking compared to the java component espreadsheet engine that we are also using. It is 3 times slower or more.

Is there anyway to load just the values and formulas as we don't need to worry about any kind of formatting; which I would think help increase the speed of loading and reduce the amount of memory used?

If this could be done; would it improve the calculation time?

The steps in our process is as follows

Load the workbook

Write values to the cells

Calculate workbook

Read calculated values from cells

If we can't improve the times we will have to discontinue using Aspose.Cells and move everything over to java and use espreadsheet engine instead.

Hi,

We recommend you to kindly download and try the latest fix: Aspose.Cells for .NET (Latest Version)

For your information, in the default scenario, when you call Workbook.CalculateFormula() after setting the formulas to get calculated value of the formula. Also, if you call Workbook.CalculateFormula() again, it will only calculate the changed cells regarding values.

a) In the first calling Workbook.CalculateFormula, by default, we will try to create a calculating chain to speed up the second, third and so on... iteration of calculations. When there are too many formulas in template file, it takes long to time to create it and consumes much memory.

If you just want to calculate formulas in the file only once, please try the following code, it will speed up the process:

C#

Console.WriteLine(DateTime.Now);

Workbook workbook = new Workbook(@"D:\FileTemp\TemplatesSAP.xlsm");

Console.WriteLine(DateTime.Now);

workbook.Settings.CreateCalcChain = false;

workbook.CalculateFormula();


Console.WriteLine(DateTime.Now);


b)We have also added Cell.Calculate() method. See following code:

C#

Workbook workbook = new Workbook();

Cell cell = workbook.Worksheets[0].Cells["A1"];

cell.Formula = "=1<2";

cell.Calculate(false,null);

Console.WriteLine(cell.Value);


Thanks and hopefully it helps,

if you still have any issues, kindly let us know.

Thank you.