Implement Custom Calculation Engine to extend the Default Calculation Engine of Aspose.Cells
Implement Custom Calculation Engine
Aspose.Cells has a powerful calculation engine that can calculate almost all of the Microsoft Excel formulas. Despite this, it also allows you to extend the default calculation engine which provides you greater power and flexibility.
The following property and classes are used in implementing this feature.
The following code implements the Custom Calculation Engine. It implements the interface AbstractCalculationEngine which has a Calculate(CalculationData data) method. This method is called against all of your formulas. Inside this method, we capture the Sum formula and increases its value by 30. So if the Aspose.Cells calculated value is 20, then our custom engine will make it 50 by adding 30.
Here is the console output of the above sample code.
Without Custom Engine Value of A1: 20 With Custom Engine Value of A1: 50