Table of Contents

Method InsertIfThenElse

Namespace
DocWright.Dom.Editing
Assembly
DocWright.Dom.dll

InsertIfThenElse(WordDocument, DocumentPosition, string, MergeComparison, string, string, string)

Inserts If...Then...Else: IF {MERGEFIELD field} op "value" "then" "else", showing elseText before any data.

public static DocumentEdit InsertIfThenElse(this WordDocument document, DocumentPosition at, string field, MergeComparison comparison, string value, string thenText, string elseText)

Parameters

document WordDocument

The document.

at DocumentPosition

Where the rule goes.

field string

The merge field compared (a list's field name).

comparison MergeComparison

The comparison.

value string

What the field is compared with (ignored for blank and not blank).

thenText string

The text when the comparison holds.

elseText string

The text when it does not.

Returns

DocumentEdit

The edit.

Exceptions

ArgumentNullException

An argument is null.

ArgumentException

The position is not in the document, the field name is not one, or a text holds a quotation mark or a control character, or is too long.