Table of Contents

Method UpdateFields

Namespace
DocWright.Dom.Editing
Assembly
DocWright.Dom.dll

UpdateFields(WordDocument, DocumentSpan, FieldUpdateOptions?)

Updates every field whose extent meets a span, as one undoable edit (Word's F9): a table of contents is rebuilt from the headings as they are now (their bookmarks reused); any other field gets its evaluated result; PAGEREF takes PageReference; PAGE and NUMPAGES are left to layout; a field that cannot be evaluated keeps its result.

public static DocumentEdit UpdateFields(this WordDocument document, DocumentSpan span, FieldUpdateOptions? options = null)

Parameters

document WordDocument

The document.

span DocumentSpan

The selection; a caret updates the fields it is in or next to.

options FieldUpdateOptions

The evaluation's clock, culture and page references, or null for invariant defaults.

Returns

DocumentEdit

The edit (empty when no field changed); the caret stays where the span ends.

Exceptions

ArgumentNullException

document is null.

ArgumentException

An end of the span is not in document.