Method RemoveFormField
RemoveFormField(WordDocument, FormField)
Removes a form field: its field characters, code and result, and the bookmark of its name around it (where Flatten() keeps the result as text).
public static DocumentEdit RemoveFormField(this WordDocument document, FormField field)
Parameters
documentWordDocumentThe document that holds the field.
fieldFormFieldThe field, as found.
Returns
- DocumentEdit
The edit; After is where the field was.
Exceptions
- ArgumentNullException
An argument is null.
- ArgumentException
The field is not in
document.- InvalidOperationException
The field spans paragraphs, or the document changed since it was found.