Class ConditionalFormattingRuleCollection
Represents a collection of conditional formatting rules.
Inherited Members
Namespace: DRIT.Spreadsheet.ConditionalFormatting
Assembly: DRIT.Spreadsheet.dll
Syntax
public class ConditionalFormattingRuleCollection : IEnumerable<ConditionalFormattingRule>, IEnumerable
Properties
this[int]
Gets the conditional formatting rule at the specified index.
Declaration
public ConditionalFormattingRule this[int index] { get; }
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | The zero-based index. |
Property Value
| Type | Description |
|---|---|
| ConditionalFormattingRule | The rule at the specified index. |
Methods
Add(ConditionalFormattingRule)
Adds an existing conditional formatting rule to the collection.
Declaration
public void Add(ConditionalFormattingRule item)
Parameters
| Type | Name | Description |
|---|---|---|
| ConditionalFormattingRule | item | The rule to add. |
AddAboveAverage(bool)
Adds an above average conditional formatting rule.
Declaration
public AboveAverageFormattingRule AddAboveAverage(bool aboveAverage)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | aboveAverage | Whether to format cells above average. |
Returns
| Type | Description |
|---|---|
| AboveAverageFormattingRule | The newly created AboveAverageFormattingRule instance. |
AddCellValue(ConditionalFormattingOperator, params double[])
Adds a cell value conditional formatting rule.
Declaration
public CellIsFormattingRule AddCellValue(ConditionalFormattingOperator conditionalFormattingOperator, params double[] values)
Parameters
| Type | Name | Description |
|---|---|---|
| ConditionalFormattingOperator | conditionalFormattingOperator | The comparison operator. |
| double[] | values | The values to compare against. |
Returns
| Type | Description |
|---|---|
| CellIsFormattingRule | The newly created CellIsFormattingRule instance. |
AddDataBar(SpreadsheetColor)
Adds a data bar conditional formatting rule.
Declaration
public DataBarFormattingRule AddDataBar(SpreadsheetColor color)
Parameters
| Type | Name | Description |
|---|---|---|
| SpreadsheetColor | color | The color for the data bar. |
Returns
| Type | Description |
|---|---|
| DataBarFormattingRule | The newly created DataBarFormattingRule instance. |
AddDatesOccurring(TimePeriod)
Adds a dates occurring conditional formatting rule.
Declaration
public DatesOccurringFormattingRule AddDatesOccurring(TimePeriod timePeriod)
Parameters
| Type | Name | Description |
|---|---|---|
| TimePeriod | timePeriod | The time period for the rule. |
Returns
| Type | Description |
|---|---|
| DatesOccurringFormattingRule | The newly created DatesOccurringFormattingRule instance. |
AddDuplicateValues()
Adds a duplicate values conditional formatting rule.
Declaration
public DuplicateValuesFormattingRule AddDuplicateValues()
Returns
| Type | Description |
|---|---|
| DuplicateValuesFormattingRule | The newly created DuplicateValuesFormattingRule instance. |
AddExpression()
Adds an expression conditional formatting rule without a formula.
Declaration
public ExpressionFormattingRule AddExpression()
Returns
| Type | Description |
|---|---|
| ExpressionFormattingRule | The newly created ExpressionFormattingRule instance. |
AddExpression(string)
Adds an expression conditional formatting rule with the specified formula.
Declaration
public ExpressionFormattingRule AddExpression(string formula1)
Parameters
| Type | Name | Description |
|---|---|---|
| string | formula1 | The formula for the rule. |
Returns
| Type | Description |
|---|---|
| ExpressionFormattingRule | The newly created ExpressionFormattingRule instance. |
AddIconSet(IconSetType)
Adds an icon set conditional formatting rule.
Declaration
public IconSetFormattingRule AddIconSet(IconSetType type)
Parameters
| Type | Name | Description |
|---|---|---|
| IconSetType | type | The icon set type. |
Returns
| Type | Description |
|---|---|
| IconSetFormattingRule | The newly created IconSetFormattingRule instance. |
AddSpecificText(SpecificTextFormattingRuleType, string)
Adds a specific text conditional formatting rule.
Declaration
public SpecificTextFormattingRule AddSpecificText(SpecificTextFormattingRuleType textOperator, string value)
Parameters
| Type | Name | Description |
|---|---|---|
| SpecificTextFormattingRuleType | textOperator | The text operator type. |
| string | value | The text value to match. |
Returns
| Type | Description |
|---|---|
| SpecificTextFormattingRule | The newly created SpecificTextFormattingRule instance. |
AddThreeColorScale(SpreadsheetColor, SpreadsheetColor, SpreadsheetColor)
Adds a three-color scale conditional formatting rule.
Declaration
public ThreeColorScaleFormattingRule AddThreeColorScale(SpreadsheetColor minColor, SpreadsheetColor midColor, SpreadsheetColor maxColor)
Parameters
| Type | Name | Description |
|---|---|---|
| SpreadsheetColor | minColor | The minimum color. |
| SpreadsheetColor | midColor | The midpoint color. |
| SpreadsheetColor | maxColor | The maximum color. |
Returns
| Type | Description |
|---|---|
| ThreeColorScaleFormattingRule | The newly created ThreeColorScaleFormattingRule instance. |
AddTimePeriod()
Adds a dates occurring conditional formatting rule with default time period.
Declaration
public DatesOccurringFormattingRule AddTimePeriod()
Returns
| Type | Description |
|---|---|
| DatesOccurringFormattingRule | The newly created DatesOccurringFormattingRule instance. |
AddTop10(int)
Adds a top 10 conditional formatting rule.
Declaration
public Top10FormattingRule AddTop10(int rank)
Parameters
| Type | Name | Description |
|---|---|---|
| int | rank | The rank value (1-10). |
Returns
| Type | Description |
|---|---|
| Top10FormattingRule | The newly created Top10FormattingRule instance. |
AddTwoColorScale(SpreadsheetColor, SpreadsheetColor)
Adds a two-color scale conditional formatting rule.
Declaration
public TwoColorScaleFormattingRule AddTwoColorScale(SpreadsheetColor minColor, SpreadsheetColor maxColor)
Parameters
| Type | Name | Description |
|---|---|---|
| SpreadsheetColor | minColor | The minimum color. |
| SpreadsheetColor | maxColor | The maximum color. |
Returns
| Type | Description |
|---|---|
| TwoColorScaleFormattingRule | The newly created TwoColorScaleFormattingRule instance. |
AddUniqueValues()
Adds a unique values conditional formatting rule.
Declaration
public UniqueValuesFormattingRule AddUniqueValues()
Returns
| Type | Description |
|---|---|
| UniqueValuesFormattingRule | The newly created UniqueValuesFormattingRule instance. |
GetEnumerator()
Returns an enumerator that iterates through the collection.
Declaration
public IEnumerator<ConditionalFormattingRule> GetEnumerator()
Returns
| Type | Description |
|---|---|
| IEnumerator<ConditionalFormattingRule> | An enumerator for the collection. |