Class ConditionalFormatting
The ConditionalFormatting class encapsulates all Settings of Conditional Formatting.
Inheritance
System.Object
ConditionalFormatting
Namespace: IronXL.Formatting
Assembly: IronXL.dll
Syntax
public class ConditionalFormatting : Object
Properties
NumberOfRules
Gets the number of rules.
Declaration
public int NumberOfRules { get; }
Property Value
Type | Description |
---|---|
System.Int32 | The number of rules. |
Methods
AddRule(ConditionalFormattingRule)
Add a Conditional Formatting rule. Excel allows to create up to 3 Conditional Formatting rules.
Declaration
public void AddRule(ConditionalFormattingRule cfRule)
Parameters
Type | Name | Description |
---|---|---|
ConditionalFormattingRule | cfRule | The Conditional Formatting rule |
GetFormattingRanges()
Returns the list of ranges to apply formatting.
Declaration
public List<RangeAddress> GetFormattingRanges()
Returns
Type | Description |
---|---|
System.Collections.Generic.List<RangeAddress> | List of range addresses. |
GetRule(Int32)
Returns the Conditional Formatting rule at specified position.
Declaration
public ConditionalFormattingRule GetRule(int idx)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | idx | Position of the rule. |
Returns
Type | Description |
---|---|
ConditionalFormattingRule | The Conditional Formatting rule at specified position. |
SetRule(Int32, ConditionalFormattingRule)
Replaces an existing Conditional Formatting rule at position idx. Excel allows to create up to 3 Conditional Formatting rules. This method can be useful to modify existing Conditional Formatting rules.
Declaration
public void SetRule(int idx, ConditionalFormattingRule cfRule)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | idx | Position of the rule. Should be between 0 and 2. |
ConditionalFormattingRule | cfRule | Conditional Formatting rule |