Repository navigation
word toc
Auto-generated table of contents based on heading levels.
Path: /toc[N]
- add - Add a table of contents
officecli set report.docx /toc[1] --prop levels=1-4 --prop hyperlinks=trueadd --type toc never fails, even over paragraphs with no real heading — officecli doesn't validate this because populating a TOC needs a pagination engine Word alone has. But when Word itself opens the file and recalculates fields, a TOC built over paragraphs that are merely bold/large Normal text (not an actual Heading1–Heading9 style, or a custom style with outlineLvl set) renders "Error! No table of contents entries found." — verify the target paragraphs carry a real heading style (or outlineLvl) before adding a TOC over them, and set updateFields=true on / or /settings so Word recomputes the entries on open instead of showing a stale/empty write-time cache. There's no hand-written static-TOC fallback for page numbers — officecli can't compute pagination, so any static number would be a guess; defer to Word via updateFields or run refresh for what it can compute (SEQ, not page numbers).
Based on OfficeCLI v1.0.137