Click or drag to resize

ConditionalFormatRuleCollectionAddContainValue Method (String, ContainValueOperator, Object)

Adds a 'Cells with Cell Value' conditional formatting rule applied to a specified sequence of references to cell ranges.

Namespace:  GemBox.Spreadsheet.ConditionalFormatting
Assembly:  GemBox.Spreadsheet (in GemBox.Spreadsheet.dll) Version:
public ContainValueCondition AddContainValue(
	string appliesTo,
	ContainValueOperator operator,
	Object value


Type: SystemString
The sequence of references to cell ranges over which the newly added conditional formatting rule is applied.
Type: GemBox.Spreadsheet.ConditionalFormattingContainValueOperator
The operator (all except Between and NotBetween).
Type: SystemObject
The value (constant or formula).

Return Value

Type: ContainValueCondition
A ContainValueCondition set to a newly created conditional formatting rule which can be used to customize the formatting.
ArgumentExceptionParameter appliesTo is or Empty.
ArgumentExceptionParameter operator is Between or NotBetween. Use other method overload for these operators.
ArgumentNullExceptionParameter value is .
ArgumentExceptionParameter value type is not supported.

Newly added rule is inserted at the beginning of the collection so it has the highest priority and is first applied.

Value can be either constant or formula.

If value is constant, then it cannot be and value's type must be supported in Value (types supported in SupportsType(Type)).

If value is formula, then value type must be String and it must start with '='.

See Also