SpreadJS 13
GC.Spread.Sheets.ConditionalFormatting Namespace / NormalConditionRule class / NormalConditionRule Constructor
The cell ranges where the rule is applied whose item type is GC.Spread.Sheets.Range.
The style that is applied to the cell when the condition is met.
The comparison operator.
The first value.
The second value.
The text for comparison.
The condition formula.
The average condition type.
The number of top or bottom items to apply the style to.
In This Topic
    NormalConditionRule Constructor
    In This Topic
    Represents a normal conditional rule.
    Syntax
    var instance = new GC.Spread.Sheets.ConditionalFormatting.NormalConditionRule(ruleType, ranges, style, operator, value1, value2, text, formula, type, rank);
    function NormalConditionRule( 
       ruleType : RuleType,
       ranges : undefined,
       style : Style,
       operator : undefined,
       value1 : Object,
       value2 : Object,
       text : string,
       formula : string,
       type : undefined,
       rank : number
    ) : NormalConditionRule;

    Parameters

    ruleType
    ranges
    The cell ranges where the rule is applied whose item type is GC.Spread.Sheets.Range.
    style
    The style that is applied to the cell when the condition is met.
    operator
    The comparison operator.
    value1
    The first value.
    value2
    The second value.
    text
    The text for comparison.
    formula
    The condition formula.
    type
    The average condition type.
    rank
    The number of top or bottom items to apply the style to.
    Example
    The following examples create rules.
    var style = new GC.Spread.Sheets.Style();
    style.backColor = "red";
    var ranges=[new GC.Spread.Sheets.Range(0,0,10,1)];
    activeSheet.conditionalFormats.addSpecificTextRule(GC.Spread.Sheets.ConditionalFormatting.TextComparisonOperators.contains, "test", style, ranges);
    activeSheet.setValue(0, 0, "testing");
    activeSheet.setValue(1, 0, "test");
    activeSheet.setValue(2, 0, "a");
    activeSheet.setValue(3, 0, "t");
    <input type="button" id="button1" value="button1"/>
    
    activeSheet.setArray(0,0,[1,2,3,4,5,6,7,8,9,10]);
    var cell = new GC.Spread.Sheets.ConditionalFormatting.NormalConditionRule();
    cell.ruleType(GC.Spread.Sheets.ConditionalFormatting.RuleType.cellValueRule);
    cell.operator(GC.Spread.Sheets.ConditionalFormatting.ComparisonOperators.greaterThan);
    cell.value1(5);
    cell.ranges([new GC.Spread.Sheets.Range(0, 0, 10, 1)]);
    var style = new GC.Spread.Sheets.Style();
    style.backColor = "red";
    cell.style(style);
    activeSheet.conditionalFormats.addRule(cell);
    
    $("#button1").click(function () {
    cell.reset();
    activeSheet.suspendPaint();
    activeSheet.resumePaint();
        });
    var style = new GC.Spread.Sheets.Style();
    style.backColor = "green";
    var ranges = [new GC.Spread.Sheets.Range(0, 0, 10, 1)];
    activeSheet.conditionalFormats.addUniqueRule(style, ranges);
    activeSheet.setValue(0, 0, 50);
    activeSheet.setValue(1, 0, 50);
    activeSheet.setValue(2, 0, 11);
    activeSheet.setValue(3, 0, 5);
    See Also