Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Duplicate 规则用于检查单元格中重复的值。

示例代码以下 代码使用了

以下代码使用了 duplicate 规则.规则。

...

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="598f3f84-e88f-4a5b-9504-e78668c5157d"><ac:plain-text-body><![CDATA[

...

Code Block

...

Copy Code

languagejs
titleJavaScript
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);

...

 

...

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

另见
更多信息

addDuplicateRule Method
addRule Method
NormalConditionRule class
RuleType Enumeration