Back to Devexpress

XlCondFmtRuleDuplicates Class

corelibraries-devexpress-dot-export-dot-xl-947d9147.md

latest2.9 KB
Original Source

XlCondFmtRuleDuplicates Class

Represents the conditional formatting rule for cells with duplicate values.

Namespace : DevExpress.Export.Xl

Assembly : DevExpress.Printing.v25.2.Core.dll

NuGet Package : DevExpress.Printing.Core

Declaration

csharp
public class XlCondFmtRuleDuplicates :
    XlCondFmtRuleWithFormatting
vb
Public Class XlCondFmtRuleDuplicates
    Inherits XlCondFmtRuleWithFormatting

Example

Note

A complete sample project is available at https://github.com/DevExpress-Examples/excel-export-api-examples

csharp
// Create an instance of the XlConditionalFormatting class. 
XlConditionalFormatting formatting = new XlConditionalFormatting();
// Specify the cell range to which the conditional formatting rules should be applied (A1:D11).
formatting.Ranges.Add(XlCellRange.FromLTRB(0, 0, 3, 10));
// Create the rule to identify duplicate values in the cell range.
formatting.Rules.Add(new XlCondFmtRuleDuplicates() { Formatting = XlCellFormatting.Bad });
// Create the rule to identify unique values in the cell range.
formatting.Rules.Add(new XlCondFmtRuleUnique() { Formatting = XlCellFormatting.Good });
// Add the specified format options to the worksheet collection of conditional formats.
sheet.ConditionalFormattings.Add(formatting);
vb
' Create an instance of the XlConditionalFormatting class. 
Dim formatting As New XlConditionalFormatting()
' Specify the cell range to which the conditional formatting rules should be applied (A1:D11).
formatting.Ranges.Add(XlCellRange.FromLTRB(0, 0, 3, 10))
' Create the rule to identify duplicate values in the cell range.
formatting.Rules.Add(New XlCondFmtRuleDuplicates() With {.Formatting = XlCellFormatting.Bad})
' Create the rule to identify unique values in the cell range.
formatting.Rules.Add(New XlCondFmtRuleUnique() With {.Formatting = XlCellFormatting.Good})
' Add the specified format options to the worksheet collection of conditional formats.
sheet.ConditionalFormattings.Add(formatting)

Inheritance

Object XlCondFmtRule XlCondFmtRuleWithFormatting XlCondFmtRuleDuplicates

See Also

XlCondFmtRuleDuplicates Members

DevExpress.Export.Xl Namespace