CalculationData

Inheritance: java.lang.Object

public class CalculationData

Represents the required data when calculating one function, such as function name, parameters, …etc.

Remarks

All objects provided by this class are for “read” purpose only. User should not change any data in the Workbook during the formula calculation process, Otherwise unexpected result or Exception may be caused.

Methods

MethodDescription
equals(Object arg0)
getCalculatedValue()Gets the calculated value for this function.
getCell()Gets the Cell object where the function is in.
getCellColumn()Gets the column index of the cell where the function is in.
getCellRow()Gets the row index of the cell where the function is in.
getClass()
getFunctionName()Gets the function name to be calculated.
getParamCount()Gets the count of parameters
getParamText(int index)Gets the literal text of the parameter at given index.
getParamValue(int index)Gets the represented value object of the parameter at given index.
getParamValueInArrayMode(int index, int maxRowCount, int maxColumnCount)Gets the value(s) of the parameter at given index.
getWorkbook()Gets the Workbook object where the function is in.
getWorksheet()Gets the Worksheet object where the function is in.
hashCode()
notify()
notifyAll()
setCalculatedValue(Object value)Sets the calculated value for this function.
toString()
wait()
wait(long arg0)
wait(long arg0, int arg1)

equals(Object arg0)

public boolean equals(Object arg0)

Parameters:

ParameterTypeDescription
arg0java.lang.Object

Returns: boolean

getCalculatedValue()

public Object getCalculatedValue()

Gets the calculated value for this function.

Remarks

User should set this property in his custom calculation engine for those functions the engine supports, and the set value will be returned when getting this property later. The set value may be of possible types of Cell.getValue(), or array of such kind of values, or a Range, Name, ReferredArea. Getting this property before setting value to it will make the function be calculated by the default calculation engine of Aspose.Cells and then the calculated value will be returned(generally it should be #NAME? for user-defined functions).

Returns: java.lang.Object

getCell()

public Cell getCell()

Gets the Cell object where the function is in.

Remarks

When calculating a formula without setting it to a cell, such as by Worksheet.calculateFormula(String,CalculationOptions), the formula will be calculated just like it has been set to cell A1, so both getCellRow() and getCellColumn() are 0. However, cell A1 in the worksheet may has not been instantiated. So for such kind of situation this property will be null.

Returns: Cell

getCellColumn()

public int getCellColumn()

Gets the column index of the cell where the function is in.

Returns: int

getCellRow()

public int getCellRow()

Gets the row index of the cell where the function is in.

Returns: int

getClass()

public final native Class<?> getClass()

Returns: java.lang.Class

getFunctionName()

public String getFunctionName()

Gets the function name to be calculated.

Returns: java.lang.String

getParamCount()

public int getParamCount()

Gets the count of parameters

Returns: int

getParamText(int index)

public String getParamText(int index)

Gets the literal text of the parameter at given index.

Parameters:

ParameterTypeDescription
indexintindex of the parameter(0 based)

Returns: java.lang.String - literal text of the parameter

getParamValue(int index)

public Object getParamValue(int index)

Gets the represented value object of the parameter at given index.

Remarks

For one parameter:

If it is plain value, then returns the plain value itself;

If it is reference, then returns ReferredArea object;

If it references to dataset(s) with multiple values, then returns array of objects;

If it is some kind of expression that needs to be calculated, then it will be calculated in value mode and generally a single value will be returned according to current cell base. For example, if one parameter of D2’s formula is A:A+B:B, then A2+B2 will be calculated and returned. However, if this parameter has been specified as array mode (by or ), then an array(object[][]) will be returned whose items are A1+B1,A2+B2,….

Parameters:

ParameterTypeDescription
indexintThe index of the parameter(0 based)

Returns: java.lang.Object - The calculated value of the parameter.

getParamValueInArrayMode(int index, int maxRowCount, int maxColumnCount)

public Object[][] getParamValueInArrayMode(int index, int maxRowCount, int maxColumnCount)

Gets the value(s) of the parameter at given index. If the parameter is some kind of expression that needs to be calculated, then it will be calculated in array mode.

Remarks

For an expression that needs to be calculated, taking A:A+B:B as an example: In value mode it will be calculated to a single value according to current cell base. But in array mode, all values of A1+B1,A2+B2,A3+B3,… will be calculated and used to construct the returned array. And for such kind of situation, it is better to specify the limit for the row/column count (such as according to Cells.getMaxDataRow() and Cells.getMaxDataColumn()), otherwise the returned large array may increase memory cost with large amount of useless data.

Parameters:

ParameterTypeDescription
indexintThe index of the parameter(0 based)
maxRowCountintThe row count limit for the returned array. If it is non-positive or greater than the actual row count, then actual row count will be used.
maxColumnCountintThe column count limit for the returned array. If it is non-positive or greater than the actual row count, then actual column count will be used.

Returns: java.lang.Object[][] - An array which contains all items represented by the specified parameter.

getWorkbook()

public Workbook getWorkbook()

Gets the Workbook object where the function is in.

Returns: Workbook

getWorksheet()

public Worksheet getWorksheet()

Gets the Worksheet object where the function is in.

Returns: Worksheet

hashCode()

public native int hashCode()

Returns: int

notify()

public final native void notify()

notifyAll()

public final native void notifyAll()

setCalculatedValue(Object value)

public void setCalculatedValue(Object value)

Sets the calculated value for this function.

Remarks

User should set this property in his custom calculation engine for those functions the engine supports, and the set value will be returned when getting this property later. The set value may be of possible types of Cell.getValue(), or array of such kind of values, or a Range, Name, ReferredArea. Getting this property before setting value to it will make the function be calculated by the default calculation engine of Aspose.Cells and then the calculated value will be returned(generally it should be #NAME? for user-defined functions).

Parameters:

ParameterTypeDescription
valuejava.lang.Object

toString()

public String toString()

Returns: java.lang.String

wait()

public final void wait()

wait(long arg0)

public final native void wait(long arg0)

Parameters:

ParameterTypeDescription
arg0long

wait(long arg0, int arg1)

public final void wait(long arg0, int arg1)

Parameters:

ParameterTypeDescription
arg0long
arg1int