You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Recalculate derived field values — TOC page numbers, PAGE / NUMPAGES, cross-references — and write them back to the document.
Synopsis
officecli refresh <file> [--json]
Description
.docx only. Two backends:
Backend
When
Notes
word
Windows + Word installed
Calls Word COM Fields.Update. Layout-accurate.
html
All other platforms (and as fallback)
Regenerates TOC bodies via the internal WordTocBuilder (4-phase pipeline mirroring LibreOffice), paginates via headless Chrome --dump-dom, then writes back PAGEREF result runs and app.xml <Pages>. TOC page numbers reflect officecli's HTML pagination and may differ from Word's layout.
The selected backend is reported on stdout (backend: word|html); the HTML fallback also prints a stderr disclaimer.
If the Word backend is unavailable and no headless browser is found, the command fails with exit code refresh_failed.
Examples
# Refresh TOC + PAGE fields in place
officecli refresh report.docx
# JSON envelope
officecli refresh report.docx --json