SpreadJS Documentation
formula Method
GC.Spread.Sheets.ConditionalFormatting Namespace > NormalConditionRule class : formula Method
The condition formula or the base row.
The base column.
Gets or sets the condition formula.
Syntax
var instance = new GC.Spread.Sheets.ConditionalFormatting.NormalConditionRule(ruleType, ranges, style, operator, value1, value2, text, formula, type, rank);
var value; // Type: any
value = instance.formula(formulaOrBaseRow, baseColumn);
function formula( 
   formulaOrBaseRow : undefined,
   baseColumn : number
) : any;

Parameters

formulaOrBaseRow
The condition formula or the base row.
baseColumn
The base column.

Return Value

If no value is set or baseRow and baseColumn is set, returns the condition formula; otherwise, returns the number condition rule.
Example
This example uses the formula method.
var style = new GC.Spread.Sheets.Style();
style.backColor = "red";
var rule = new GC.Spread.Sheets.ConditionalFormatting.NormalConditionRule();
rule.ruleType(GC.Spread.Sheets.ConditionalFormatting.RuleType.FormulaRule);
rule.formula("=A1=B1+C1");
rule.ranges([new GC.Spread.Sheets.Range(0, 0, 2, 1)]);
rule.style(style);
activeSheet.conditionalFormats.addRule(rule);
activeSheet.setValue(0, 0, 2,3);
activeSheet.setValue(0, 1, 1,3);
activeSheet.setValue(0, 2,1,3);
activeSheet.setValue(1, 0, 1,3); 
See Also

Reference

NormalConditionRule class