Back to Devexpress

XlCondFmtRuleSpecificText Class

corelibraries-devexpress-dot-export-dot-xl-3d3e32b5.md

latest3.1 KB
Original Source

XlCondFmtRuleSpecificText Class

Represents “A Text That Contains…” conditional formatting rule.

Namespace : DevExpress.Export.Xl

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

NuGet Package : DevExpress.Printing.Core

Declaration

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

Remarks

The conditional formatting rule specified by the XlCondFmtRuleSpecificText object highlights cells based on the text they contain.

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 rule should be applied (B2:B7).
formatting.Ranges.Add(XlCellRange.FromLTRB(1, 1, 1, 6));
// Create the rule to highlight cells that contain the given text.
XlCondFmtRuleSpecificText rule = new XlCondFmtRuleSpecificText(XlCondFmtSpecificTextType.Contains, "worldwide");
// Specify formatting settings to be applied to cells if the condition is true.
rule.Formatting = XlCellFormatting.Neutral;
formatting.Rules.Add(rule);
// 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 rule should be applied (B2:B7).
formatting.Ranges.Add(XlCellRange.FromLTRB(1, 1, 1, 6))
' Create the rule to highlight cells that contain the given text.
Dim rule As New XlCondFmtRuleSpecificText(XlCondFmtSpecificTextType.Contains, "worldwide")
' Specify formatting settings to be applied to cells if the condition is true.
rule.Formatting = XlCellFormatting.Neutral
formatting.Rules.Add(rule)
' Add the specified format options to the worksheet collection of conditional formats.
sheet.ConditionalFormattings.Add(formatting)

Inheritance

Object XlCondFmtRule XlCondFmtRuleWithFormatting XlCondFmtRuleSpecificText

See Also

XlCondFmtRuleSpecificText Members

DevExpress.Export.Xl Namespace