Page tree
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

The formula rule allows you to use formulas when checking the condition.
Using Code
This example creates a formula rule.

JavaScript

Copy Code

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="93180c40-b145-4f23-9678-e4b76d9a31ee"><ac:plain-text-body><![CDATA[

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);// ORvar 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);

 

]]></ac:plain-text-body></ac:structured-macro>

See Also
NormalConditionRule class
addFormulaRule Method
addRule Method
RuleType Enumeration

  • No labels