Table of Contents

Method AddCellValue

Namespace
DocWright.Spreadsheet
Assembly
DocWright.Spreadsheet.dll

AddCellValue(XlsxCellRange, XlsxConditionOperator, string, string?, XlsxDifferentialStyle)

Adds a rule that formats cells whose value compares with one or two formulas (Excel's Cell Value).

public XlsxConditionalFormat AddCellValue(XlsxCellRange range, XlsxConditionOperator @operator, string formula1, string? formula2, XlsxDifferentialStyle format)

Parameters

range XlsxCellRange

The cells.

operator XlsxConditionOperator

The comparison.

formula1 string

A number, a text in double quotes, or a formula, with or without its =.

formula2 string

The upper bound, for Between and NotBetween only.

format XlsxDifferentialStyle

What the rule changes.

Returns

XlsxConditionalFormat

The rule.

Exceptions

ArgumentNullException

formula1 or format is null, or Between has no second formula.

ArgumentException

A formula is not one Excel reads, or the format sets nothing.

InvalidOperationException

The sheet is not a worksheet.