Skip to main content

Module fields

Module fields 

Source
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§

FieldUpdate
One field whose cached result update_fields rewrote.
Updated
Output of update_fields.

Enums§

FieldError
Why update_fields failed.

Constants§

BOOKMARK_NOT_DEFINED
What Word writes for a PAGEREF to a bookmark the document lacks.
NO_TOC_ENTRIES
What Word writes for a TOC that finds no heading.
REFERENCE_NOT_FOUND
What Word writes for a REF to a bookmark the document lacks.

Functions§

update_fields
Refresh PAGEREF, REF, NUMPAGES, SEQ and TOC cached results in the body, headers, footers and notes.