Expand description
Refresh a table of contents and other fields (needs render).
Refresh the cached results of fields from jubarte’s own layout.
update_fields rebuilds every body TOC from the heading paragraphs,
lays the document out once, then writes the results of PAGEREF, REF,
NUMPAGES and SEQ fields in the body, headers, footers and notes. The
field codes stay, so Word can refresh them later; w:updateFields is
not set.
Page numbers come from jubarte’s layout, which matches Word on most
documents but not all (see docs/WORD_DIFFERENCES.md). A field whose
switches this module does not implement keeps its cached result; so does
a PAGEREF to a bookmark the layout could not page (a bookmark outside
any paragraph, or one in a header). PAGE is never written — its result
differs on every page.
The error strings Word writes for an unresolvable reference
(BOOKMARK_NOT_DEFINED, REFERENCE_NOT_FOUND,
NO_TOC_ENTRIES) are the public side of that fallback.
Structs§
- Field
Update - One field whose cached result
update_fieldsrewrote. - Updated
- Output of
update_fields.
Enums§
- Field
Error - Why
update_fieldsfailed.
Constants§
- BOOKMARK_
NOT_ DEFINED - What Word writes for a
PAGEREFto a bookmark the document lacks. - NO_
TOC_ ENTRIES - What Word writes for a
TOCthat finds no heading. - REFERENCE_
NOT_ FOUND - What Word writes for a
REFto a bookmark the document lacks.
Functions§
- update_
fields - Refresh
PAGEREF,REF,NUMPAGES,SEQandTOCcached results in the body, headers, footers and notes.