.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+
.NET Core 3.0+
Row

SpecialConditionalFormatting Interface

Represents a conditional formatting rule that formats cells with specific values.

Namespace: DevExpress.Spreadsheet

Assembly: DevExpress.Spreadsheet.v19.2.Core.dll

Declaration

public interface SpecialConditionalFormatting :
    ConditionalFormatting,
    ISupportsFormatting
Public Interface SpecialConditionalFormatting
    Inherits ConditionalFormatting,
             ISupportsFormatting
public interface SpecialConditionalFormatting :
    ConditionalFormatting,
    ISupportsFormatting
Public Interface SpecialConditionalFormatting
    Inherits ConditionalFormatting,
             ISupportsFormatting
public interface SpecialConditionalFormatting :
    ConditionalFormatting,
    ISupportsFormatting
Public Interface SpecialConditionalFormatting
    Inherits ConditionalFormatting,
             ISupportsFormatting

Remarks

The conditional formatting rule specified by the SpecialConditionalFormatting object highlights cells that contain specific values (such as duplicate or unique values, formula errors, etc.). The Worksheet.ConditionalFormattings property returns the ConditionalFormattingCollection collection that stores all conditional formatting rules specified on a worksheet. Use the methods of the ConditionalFormattingCollection object to apply (the ConditionalFormattingCollection.AddSpecialConditionalFormatting method) or remove (the ConditionalFormattingCollection.Remove method) the conditional format.

Examples

This example demonstrates how to specify the rule that highlights unique or duplicate values, formula errors, etc.

  1. To create a new conditional formatting rule represented by the SpecialConditionalFormatting object, access the collection of conditional formats from the Worksheet.ConditionalFormattings property and call the ConditionalFormattingCollection.AddSpecialConditionalFormatting method. Pass the following parameters:

  2. Specify formatting options to be applied to cells if the condition is true, using the ISupportsFormatting.Formatting property of the SpecialConditionalFormatting object.

To remove the SpecialConditionalFormatting object, use the ConditionalFormattingCollection.Remove, ConditionalFormattingCollection.RemoveAt or ConditionalFormattingCollection.Clear methods.

' Create the rule to identify unique values in cells A2 through A15. 
Dim cfRule As SpecialConditionalFormatting = worksheet.ConditionalFormattings.AddSpecialConditionalFormatting(worksheet.Range("$A$2:$A$15"), ConditionalFormattingSpecialCondition.ContainUniqueValue)
' Specify formatting options to be applied to cells if the condition is true.
' Set the background color to yellow.
cfRule.Formatting.Fill.BackgroundColor = Color.FromArgb(255, &HFA, &HF7, &HAA)
See Also