Aspose.Excel Formula Calculation Engine

Good Day,

I was wondering what the Formula Calculation Engine was. Is it used to embed calculations within a spreadsheet using Aspose, or is it used on a spreadsheet that already has embeded formulas, as whenever an edit is performed on a cell, then all calculations will be updated?

Thanks

Eric P.

Hi Eric,

Generally to create a formula in a cell, a component only has to parse the formula and save it to Excel file. When opening the file, MS Excel will calculate formula result automatically.

Aspose.Excel does more. If you set a formula, such as “=Sum(A1:B2)”, to cell D1, you may want to get the result of cell D1. Aspose.Excel can calculate the formula and generate the result. The engine works on formulas set at run time or embedded in a pre-designed file.

The engine doesn’t work whenever an cell edit is performed, but run while you call Excel.CaculateFormula method. The calculation is time-consuming, so repeatedly calculation will heavily slow down the component. You should call the method explicitly after you have set all formulas.

Now not all excel functions are supported. If you have any special need for the excel function, please let me know. We will add it to the engine.

@EricP,
Aspose.Excel is deprecated and no more under active development. It is replaced by another highly efficient and feature rich product Aspose.Cells. This new product provides lot more control over the calculation engine like implementing custom calculation engine to extend the Aspose.Cells calculation engine, directly calculating the formulas, setting shared formulas, decreasing the calculation time of Cell.Calculate function, setting formula calculation mode of workbook and many more other features are supported. Here is a simple example to directly calculating the formula.

// Create a workbook
Workbook workbook = new Workbook();

// Access first worksheet
Worksheet worksheet = workbook.Worksheets[0];

// Put 20 in cell A1
Cell cellA1 = worksheet.Cells["A1"];
cellA1.PutValue(20);

// Put 30 in cell A2
Cell cellA2 = worksheet.Cells["A2"];
cellA2.PutValue(30);

// Calculate the Sum of A1 and A2
var results = worksheet.CalculateFormula("=Sum(A1:A2)");

// Print the output
System.Console.WriteLine("Value of A1: " + cellA1.StringValue);
System.Console.WriteLine("Value of A2: " + cellA2.StringValue);
System.Console.WriteLine("Result of Sum(A1:A2): " + results.ToString());

Following articles can be referred for more information on working with calculation engine and other formula calculation related features:
Formula Calculation Engine in Aspose.Cells
Implement Custom Calculation Engine to extend the Default Calculation Engine of Aspose.Cells
Ways to Calculate Formulas
Working with Calculation Engine

Download the latest version for a free trail of this product:
Aspose.Cells for .NET(Latest version)

Here you can download a ready to run solution that can be used to test different features of this product without any coding.