Table of Contents

Method AddExpression

Namespace
DocWright.Spreadsheet
Assembly
DocWright.Spreadsheet.dll

AddExpression(XlsxCellRange, string, XlsxDifferentialStyle)

Adds a rule that formats cells for which a formula is true (Excel's "Use a formula"). Excel calculates it; this library does not, so EffectiveStyle(int, int, XlsxConditionalOptions?) leaves it unjudged.

public XlsxConditionalFormat AddExpression(XlsxCellRange range, string formula, XlsxDifferentialStyle format)

Parameters

range XlsxCellRange

The cells.

formula string

The formula, for the range's first cell (it moves with each cell, as Excel's does).

format XlsxDifferentialStyle

What the rule changes.

Returns

XlsxConditionalFormat

The rule.

Exceptions

ArgumentNullException

An argument is null.

ArgumentException

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

InvalidOperationException

The sheet is not a worksheet.