Method InsertIfThenElse
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
documentWordDocumentThe document.
atDocumentPositionWhere the rule goes.
fieldstringThe merge field compared (a list's field name).
comparisonMergeComparisonThe comparison.
valuestringWhat the field is compared with (ignored for blank and not blank).
thenTextstringThe text when the comparison holds.
elseTextstringThe 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.