[]
Represents a conditional formatting rule that highlights duplicate or unique values in a range.
The IUniqueValues object uses the DupeUnique property to get or set whether the rule should look for duplicate or unique values in the applied range. You can create this rule by using AddUniqueValues() and then customize its formatting and target range.
public interface IUniqueValues
Public Interface IUniqueValues
worksheet.Range["A1:A5"].Value = new object[,] {
{100}, {100}, {200}, {300}, {300}
};
IUniqueValues condition = worksheet.Range["A1:A5"].FormatConditions.AddUniqueValues();
condition.Interior.Color = Color.Yellow;
condition.DupeUnique = DupeUnique.Unique;
| Name | Description |
|---|---|
| AppliesTo | Gets or sets an IRange object specifying the cell range to which the formatting rule is applied. Use the AppliesTo property to change the range associated with this unique-values or duplicate-values conditional formatting rule. |
| Borders | Gets an instance of IBorders which represents the borders of this conditional format. Use the returned IBorders object to configure border formatting for cells that match this IUniqueValues rule. |
| DupeUnique | Gets or sets if the conditional format rule is looking for unique or duplicate values. Use this property to determine whether the IUniqueValues rule is configured to match duplicate values or unique values in the applied range. |
| Font | Gets an instance of IFont that represents the font of this conditional format. |
| Interior | Gets an instance of IInterior that represents the background color of this conditional format.
Use the returned IInterior object to configure the fill formatting that is applied when
the unique-values or duplicate-values conditional formatting rule evaluates to |
| NumberFormat | Gets or sets the number format applied to a cell when the conditional formatting rule evaluates to Use this property to retrieve the format code currently configured for a unique-values or duplicate-values conditional formatting rule. |
| Priority | Gets or sets the priority value of the conditional formatting rule. The priority determines the order of evaluation when multiple conditional formatting rules exist in a worksheet. |
| StopIfTrue | Gets or sets a Boolean value that determines if additional formatting rules on the cell should be evaluated if the current rule evaluates to true.
If this property is |
| Type | Gets the type of this conditional format. Use this property to identify the conditional formatting rule type represented by this IUniqueValues instance. For a unique-values or duplicate-values rule, the returned value is UniqueValues. |
| Name | Description |
|---|---|
| Delete() | Deletes this conditional format. Use this method to remove the current unique-values or duplicate-values conditional formatting rule from its worksheet. |
| FromJson(string) | Generates the conditional format from the specified JSON string. Use this method to restore the settings of a unique-values or duplicate-values conditional formatting rule from its JSON representation, such as a string returned by ToJson(). |
| SetFirstPriority() | Sets the priority value for this conditional formatting rule to "1" so that it will be evaluated before all other rules on the worksheet. |
| SetLastPriority() | Sets the evaluation order for this conditional formatting rule so it is evaluated after all other rules on the worksheet. |
| ToJson() | Generates a JSON string from the conditional format. Use this method to serialize the current unique-values or duplicate-values conditional formatting rule, including its settings and formatting, to a JSON string that can be reused with FromJson(string). |