Method InsertTextFormField
InsertTextFormField(WordDocument, DocumentPosition, TextFormFieldOptions?)
Inserts a text form field at a position, splitting a text run there, inside a bookmark of its name.
public static DocumentEdit InsertTextFormField(this WordDocument document, DocumentPosition at, TextFormFieldOptions? options = null)
Parameters
documentWordDocumentThe document that holds the position.
atDocumentPositionWhere to insert.
optionsTextFormFieldOptionsThe name, the default text, the type, the length, the format and the shared options; null for Word's defaults.
Returns
- DocumentEdit
The edit; After is just past the field. Find the field with
FindFormField(name).
Exceptions
- ArgumentNullException
documentis null.- ArgumentException
The position is not in the document, or an option is refused (a name already used, not a name Word takes, a text XML cannot carry, a length below 1).
- InvalidOperationException
The position is inside content a reader synthesized or a shape's text box.