xref_add
Insert a tracked cross-reference field in a Word document, pointing to a caption or paragraph, with options for number, text, or page. Adds a bookmark if needed; fields.update resolves it.
Instructions
Insert a cross-reference field (REF, or PAGEREF for the page) at an insertion point, as a tracked insertion, pointing at a caption or another body paragraph. The target gets a hidden bookmark when it has none that fits. fields.update fills in the shown number, text or page.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| at | Yes | Insertion point: p<n>#<fp>:<k>-<k>, or a paragraph address for its end. | |
| to | Yes | Address of the caption or heading it points at. | |
| doc | Yes | Path to the .docx. | |
| tag | No | Appended to the author. | |
| show | No | number (default): a caption's label and number, or a paragraph's number; page: the page it is on; text: the caption or paragraph text. | |
| author | No | Revision author. | |
| expect | No | ||
| dry_run | No | Preview only; write nothing. |