Method SetDocumentVariable
SetDocumentVariable(WordDocument, string, string)
Sets a variable, adding it at the end when the document has none of that name.
public static DocumentEdit SetDocumentVariable(this WordDocument document, string name, string value)
Parameters
documentWordDocumentThe document.
namestringThe name: not empty.
valuestringThe value.
Returns
- DocumentEdit
The edit (empty when nothing changed).
Exceptions
- ArgumentNullException
An argument is null.
- ArgumentException
The name is empty, or a text holds a character XML cannot carry.
- InvalidOperationException
The variables hold more than 4,096, or markup that is not a variable.