Method UpdateField
UpdateField(WordDocument, DocumentPosition, FieldUpdateOptions?)
Updates the one field at a position, as one undoable edit: the innermost field whose extent holds the position (a reference inside a table of contents entry is that reference, not the table). A table of contents is rebuilt; any other field gets its evaluated result, as UpdateFields(WordDocument, DocumentSpan, FieldUpdateOptions?) gives it; nothing else changes.
public static DocumentEdit UpdateField(this WordDocument document, DocumentPosition at, FieldUpdateOptions? options = null)
Parameters
documentWordDocumentThe document.
atDocumentPositionA position in the field, or at its start or end.
optionsFieldUpdateOptionsThe evaluation's clock, culture and page references, or null for invariant defaults.
Returns
- DocumentEdit
The edit; empty when there is no field there or its result is already right.
Exceptions
- ArgumentNullException
documentis null.- ArgumentException
The position is not in
document.