SpreadJS Documentation
GC.Spread.Sheets.ConditionalFormatting Namespace / ConditionalFormats type / addDateOccurringRule Method
The data occurring type.
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.
In This Topic
    addDateOccurringRule Method
    In This Topic
    Adds the date occurring rule to the rule collection.
    Syntax
    var instance = new GC.Spread.Sheets.ConditionalFormatting.ConditionalFormats(worksheet);
    var value; // Type: object
    value = instance.addDateOccurringRule(type, style, ranges);
    function addDateOccurringRule( 
       type : DateOccurringType,
       style : Style,
       ranges : undefined
    ) : object;

    Parameters

    type
    The data occurring type.
    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 date occurring rule added to the rule collection.
    Example
    This example uses the addDateOccurringRule method.
    var style = new GC.Spread.Sheets.Style();
    style.backColor = "red";
    
    var d = new Date();
    activeSheet.setValue(0, 0, d);
    activeSheet.setValue(1, 0, new Date(d.setDate(d.getDate()+1)));
    activeSheet.setValue(2, 0, new Date(d.setDate(d.getDate()+5)));
    activeSheet.setValue(3, 0,new Date(d.setDate(d.getDate()+6)));
    activeSheet.setValue(4, 0,new Date(d.setDate(d.getDate()+7)));
    activeSheet.setValue(5, 0, new Date(d.setDate(d.getDate()+8)));
    
    activeSheet.conditionalFormats.addDateOccurringRule(GC.Spread.Sheets.ConditionalFormatting.DateOccurringType.nextWeek, style, [new GC.Spread.Sheets.Range(0,0,10,1)]);
    See Also