mirror of
https://github.com/dolanmiu/docx.git
synced 2026-11-30 16:47:55 +01:00
* feat(layout): write page references with \p and in formats of their own, and lay out PAGE and SECTION, as Word does Page references with \p write "above", "below" or "on page N", and page references, numbers of pages and page numbers are written and laid out in their own formats, pictures and capitals, as Word's PDFs of word-watertight-fields, word-watertight-pages and word-page-fields show. Bookmarks, PAGE and SECTION in footnotes and endnotes take their reference's page and section. A date or time in the body stops the layout (decision D2). * docs(layout-probes): keep word-character-widths' instructions together, after which word-page-fields' follow The word-page-fields block split them, so "It reads word-italic-widths the same way" read as if word-page-fields.py did. * perf(layout): collect the page references with \p to a bookmark in place Each one copied the list of those before it, so a document with many to one bookmark took time growing with their square, as CodeRabbit's review pointed out. * fix(layout): read a date, or a field in a format not yet written, in hidden text as nothing Hidden text takes no room, so its field results can't move a line, and the layout shouldn't stop at them. A DATE or TIME field, a date block, or a page field in a format not followed stopped it even in hidden text. * test(layout): count each page reference with \p once in a table sized with tracked changes, as docx counts them #3636 reads a cell with deleted text a second time to size its table's columns, and reads deleted rows and their deleted text to size them. Rebasing onto it, those reads were kept from counting the page references with \p again or in deleted text, which docx's writer doesn't count, so each result is written into the field it was worked out for.