AbstractCalculationEngine Class

Represents user's custom calculation engine to extend the default calculation engine of Aspose.Cells.
Inheritance Hierarchy

Namespace:  Aspose.Cells
Assembly:  Aspose.Cells (in Aspose.Cells.dll) Version: (21.1)
public abstract class AbstractCalculationEngine

The AbstractCalculationEngine type exposes the following members.

Protected methodAbstractCalculationEngine
Initializes a new instance of the AbstractCalculationEngine class
Public propertyIsParamLiteralRequired
Indicates whether this engine needs the literal text of parameter while doing calculation. Default value is false.
Public propertyProcessBuiltInFunctions
Whether built-in functions that have been supported by the built-in engine should be checked and processed by this implementation. Default is false. If user needs to change the calculation logic of some built-in functions, this property should be set as true.
Public methodCalculate
Calculates one function with given data.
Public methodEquals (Inherited from Object.)
Protected methodFinalize (Inherited from Object.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetType (Inherited from Object.)
Protected methodMemberwiseClone (Inherited from Object.)
Public methodToString (Inherited from Object.)
User should not modify any part of the Workbook directly in this implementation(except the calculated result of the custom function, which can be set by CalculationData.CalculatedValue property). Otherwise unexpected result or Exception may be caused. If user needs to change other data than calculated result in the implementation for some custom functions, for example, change cell's formula, style, ...etc., user should gather those data in this implementation and change them out of the scope of formula calculation.
public class MyEngine : AbstractCalculationEngine
    public override void Calculate(CalculationData data)
        string funcName = data.FunctionName.ToUpper();
        if ("MYFUNC".Equals(funcName))
            //do calculation for MYFUNC here
            int count = data.ParamCount;
            object res = null;
            for (int i = 0; i < count; i++)
                object pv = data.GetParamValue(i);
                if (pv is ReferredArea)
                    ReferredArea ra = (ReferredArea)pv;
                    pv = ra.GetValue(0, 0);
                //process the parameter here
                //res = ...;
            data.CalculatedValue = res;
See Also