SpreadJS Documentation
evaluateFormula Method
GC.Spread.Sheets Namespace > CalcEngine type : evaluateFormula Method
The evaluation context; in general, you should use the active sheet object.
The formula string.
The base row index of the formula.
The base column index of the formula.
Whether to use the r1c1 reference style.
Evaluates the specified formula.
Syntax
var value; // Type: object
value = GC.Spread.Sheets.CalcEngine.evaluateFormula(context, formula, baseRow, baseColumn, useR1C1);
function evaluateFormula( 
   context : object,
   formula : string,
   baseRow : number,
   baseColumn : number,
   useR1C1 : boolean
) : object;

Parameters

context
The evaluation context; in general, you should use the active sheet object.
formula
The formula string.
baseRow
The base row index of the formula.
baseColumn
The base column index of the formula.
useR1C1
Whether to use the r1c1 reference style.

Return Value

The evaluated formula result.
Example


var spread = new GC.Spread.Sheets.Workbook(document.getElementById('ss'), { sheetCount: 1 });
sheet = spread.getSheet(0);
sheet.setValue(0, 0, 1);
sheet.setValue(1, 0, 2);
// Using EvaluateFormula() method to evaluate formula without setting formula in sheet's cell
var result = GC.Spread.Sheets.CalcEngine.evaluateFormula(sheet, "SUM(A1:A2)", 0, 0);
console.log("SUM(A1:A2) = " + result);
Remarks

See Also

Reference

CalcEngine type