public abstract class GridAbstractCalculationEngine
extends java.lang.Object
Remarks
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 GridCalculationData.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.Example
class MyEngine extends GridAbstractCalculationEngine
{
public /*override*/ void calculate(GridCalculationData data)
{
String funcName = data.getFunctionName().toUpperCase();
if ("MYFUNC".equals(funcName))
{
//do calculation for MYFUNC here
int count = data.getParamCount();
Object res = null;
for (int i = 0; i <count; i++)
{
Object pv = data.getParamValue(i);
if (pv instanceof GridReferredArea)
{
GridReferredArea ra = (GridReferredArea)pv;
pv = ra.getValue(0, 0);
}
//process the parameter here
//res = ...;
}
data.setCalculatedValue(res);
}
}
}
| Constructor and Description |
|---|
GridAbstractCalculationEngine() |
| Modifier and Type | Method and Description |
|---|---|
abstract void |
calculate(GridCalculationData data)
Calculates one function with given data.
|
public abstract void calculate(GridCalculationData data)
Remarks
User should set the calculated value for given data for all functions(including excel native functions) that he wants to calculate by himself in this implementation.data - The required data to calculate function such as function name, parameters, ...etc.See Also:
Aspose.Cells Documentation - the home page for the Aspose.Cells Product Documentation.
Aspose.Cells Support Forum - our preferred method of support.
We guarantee a prompt response to any inquiry!
© Aspose Pty Ltd 2003-2025. All Rights Reserved.