Spread.Sheets Documentation > Developer's Guide > Customizing the Appearance > Using Conditional Formatting > Using the Duplicate Rule |
The duplicate rule checks for duplicate values.
This example creates a duplicate rule.
JavaScript |
Copy Code
|
---|---|
var style = new GC.Spread.Sheets.Style(); style.backColor = "yellow"; var ranges=[new GC.Spread.Sheets.Range(0,0,10,1)]; activeSheet.conditionalFormats.addDuplicateRule(style, ranges); activeSheet.setValue(0, 0, 50); activeSheet.setValue(1, 0, 50); activeSheet.setValue(2, 0, 11); activeSheet.setValue(3, 0, 5); // OR var style = new GC.Spread.Sheets.Style(); style.backColor = "yellow"; var rule = new GC.Spread.Sheets.ConditionalFormatting.NormalConditionRule(); rule.ruleType(GC.Spread.Sheets.ConditionalFormatting.RuleType.DuplicateRule); rule.ranges([new GC.Spread.Sheets.Range(0,0,10,1)]); rule.style(style); activeSheet.conditionalFormats.addRule(rule); activeSheet.setValue(0, 0, 50); activeSheet.setValue(1, 0, 50); activeSheet.setValue(2, 0, 11); activeSheet.setValue(3, 0, 5); |