Works out the page each bookmark of a document starts on, and how many pages the document and each of its sections
have, by laying out its pages as Word does, so the page numbers of its tables of contents and page references, and its
numbers of pages, are written with it. Give it to a document as its pageNumbers, or to patchDocument as its
pageNumbers to write a template's once it is patched:
The pages are laid out with the widths and heights of the fonts Word documents use most, such as Calibri, Cambria,
Arial and Times New Roman, and of those made as wide, such as Carlito, and text in the fonts the document embeds is
measured from their files, but for fonts Office also offers. To measure text in other fonts, such as Aptos, from their files, use
estimatePageNumbersWith. It follows paragraphs' spacing, indents, line spacing, tab stops and keep settings, widow
and orphan control, lists, pictures in the line, tables, whose rows break across pages, footnotes and endnotes, page,
column and section breaks, and each section's page size, margins, columns, headers, footers and page numbering.
It stops at the first thing it can't lay out yet: a drawing or table that text flows around, a text box or frame, an
equation, a footnote that continues on the next page, columns evened out before a continuous section break, a line in
a table cell that is taller than a page, text in a font that isn't in the width tables and isn't embedded, such as
Garamond, text in a font the document embeds that Office also offers, such as Pacifico, which Word for Mac draws in
Office's own copy of it, a character whose width in its font isn't known, such as a mathematical symbol in Calibri, which Word draws in
Cambria Math, a word Word may hyphenate, in a document that hyphenates its words, as which parts Word breaks it into
is in its own dictionaries, or a date in the text, which Word writes when it opens the document. The page references
to bookmarks after it are left blank, for Word to fill in when it updates the fields. A document in compatibility
mode, which Word lays out as an older version of Word did, isn't laid out at all, nor is one with a compatibility
setting that changes Word's lines in a way not yet followed: suppressTopSpacing or useFELayout turned on, or one
of Word's own the layout doesn't know, on or off. The schema's other settings, which ask for an older Word's or
another application's layout, Word lays out lines with as without them, and settings for other applications are left
to them. When laying the pages out again with the page numbers it worked out still changes them after three passes,
as when a table of contents wraps one way with a number and the other way without it, all of them are left blank. To
lay out past what it stops at with the best guess it has instead, give the document
estimatePageNumbersWith({ guess: true }).
Page references are written as Word writes them, with \p ("above", "below" or "on page 4") and in formats of their
own, such as \* roman, and so are numbers of pages. Page references, tables of contents and SEQ fields (caption
numbers, which are counted without laying out the pages) are written clean, so Word shows the numbers as they are
written, and the numbers left blank stay blank, without asking to update the fields, unless the document has
updateFields on. The entry of a numbered heading in a table of contents starts with the heading's number, and a tab
to a tab stop past it, as Word writes it (listNumbers).
Works out the page each bookmark of a document starts on, and how many pages the document and each of its sections have, by laying out its pages as Word does, so the page numbers of its tables of contents and page references, and its numbers of pages, are written with it. Give it to a document as its
pageNumbers, or topatchDocumentas itspageNumbersto write a template's once it is patched:The pages are laid out with the widths and heights of the fonts Word documents use most, such as Calibri, Cambria, Arial and Times New Roman, and of those made as wide, such as Carlito, and text in the fonts the document embeds is measured from their files, but for fonts Office also offers. To measure text in other fonts, such as Aptos, from their files, use estimatePageNumbersWith. It follows paragraphs' spacing, indents, line spacing, tab stops and keep settings, widow and orphan control, lists, pictures in the line, tables, whose rows break across pages, footnotes and endnotes, page, column and section breaks, and each section's page size, margins, columns, headers, footers and page numbering.
It stops at the first thing it can't lay out yet: a drawing or table that text flows around, a text box or frame, an equation, a footnote that continues on the next page, columns evened out before a continuous section break, a line in a table cell that is taller than a page, text in a font that isn't in the width tables and isn't embedded, such as Garamond, text in a font the document embeds that Office also offers, such as Pacifico, which Word for Mac draws in Office's own copy of it, a character whose width in its font isn't known, such as a mathematical symbol in Calibri, which Word draws in Cambria Math, a word Word may hyphenate, in a document that hyphenates its words, as which parts Word breaks it into is in its own dictionaries, or a date in the text, which Word writes when it opens the document. The page references to bookmarks after it are left blank, for Word to fill in when it updates the fields. A document in compatibility mode, which Word lays out as an older version of Word did, isn't laid out at all, nor is one with a compatibility setting that changes Word's lines in a way not yet followed:
suppressTopSpacingoruseFELayoutturned on, or one of Word's own the layout doesn't know, on or off. The schema's other settings, which ask for an older Word's or another application's layout, Word lays out lines with as without them, and settings for other applications are left to them. When laying the pages out again with the page numbers it worked out still changes them after three passes, as when a table of contents wraps one way with a number and the other way without it, all of them are left blank. To lay out past what it stops at with the best guess it has instead, give the documentestimatePageNumbersWith({ guess: true }).Page references are written as Word writes them, with
\p("above", "below" or "on page 4") and in formats of their own, such as\* roman, and so are numbers of pages. Page references, tables of contents and SEQ fields (caption numbers, which are counted without laying out the pages) are written clean, so Word shows the numbers as they are written, and the numbers left blank stay blank, without asking to update the fields, unless the document hasupdateFieldson. The entry of a numbered heading in a table of contents starts with the heading's number, and a tab to a tab stop past it, as Word writes it (listNumbers).