SpreadJS Documentation
addFormulaRule Method
GC.Spread.Sheets.ConditionalFormatting Namespace > ConditionalFormats type : addFormulaRule Method
The condition formula.
The style that is applied to the cell when the condition is met.
The cell ranges where the rule is applied whose item type is GC.Spread.Sheets.Range.
Adds the formula rule to the rule collection.
Syntax
var instance = new GC.Spread.Sheets.ConditionalFormatting.ConditionalFormats(worksheet);
var value; // Type: object
value = instance.addFormulaRule(formula, style, ranges);
function addFormulaRule( 
   formula : string,
   style : Style,
   ranges : undefined
) : object;

Parameters

formula
The condition formula.
style
The style that is applied to the cell when the condition is met.
ranges
The cell ranges where the rule is applied whose item type is GC.Spread.Sheets.Range.

Return Value

The formula rule added to the rule collection.
Example
This example uses the addFormulaRule method.
var style = new GC.Spread.Sheets.Style();
style.backColor = "red";
var ranges = [new GC.Spread.Sheets.Range(0, 0, 2, 1)];
activeSheet.conditionalFormats.addFormulaRule("=A1=B1+C1", style, ranges);
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

ConditionalFormats type