Class GridAbstractCalculationEngine

GridAbstractCalculationEngine class

Represents user’s custom calculation engine to extend the default calculation engine of Aspose.Cells.

public abstract class GridAbstractCalculationEngine

Methods

NameDescription
abstract Calculate(GridCalculationData)Calculates one function with given data.

Examples

[C#]
 class MyEngine : GridAbstractCalculationEngine
{
    public override void Calculate(GridCalculationData 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 GridReferredArea)
                {
                    GridReferredArea ra = (GridReferredArea)pv;
                    pv = ra.GetValue(0, 0);
                }
                //process the parameter here
                //res = ...;
            }
            data.CalculatedValue = res;
        }
    }
}

See Also