mirror of
https://github.com/dolanmiu/docx.git
synced 2026-11-30 16:47:55 +01:00
* feat(layout): give the pages of a document and what is on each, as Word lays them out layoutDocument, from docx/layout, lays out a document's pages as estimatePageNumbers does, and gives what is on each page: the lines of its paragraphs, with their text and where they are, the rows of its tables, its footnotes and endnotes, and which of its section's headers and footers it shows. Lengths are in pixels. Where the layout stops, it gives the pages up to there and why, in stoppedAt, rather than throwing. Word's PDF of a new probe, word-positions.docx, showed that each line starts where its paragraph's indents, its column and the margin put it, to within 0.2 points, that the blank page Word adds before a section on an odd or even page has no header or footer, and two ways docx/layout differed from Word, fixed here: - A tab typed in a TextRun's text, which docx writes in w:t, is a tab in Word. docx/layout measured it as a letter. - Word decides whether a section on an odd or even page needs a blank page before it by the page's number before the section's own first number: after page 6, a section on an even page numbered from 2 starts on page 8. docx/layout went by the section's first number. * fix(layout): give a page's footnotes in the width they were laid out in The room for a page's footnotes is worked out in the text width of the section being laid out when they are added, but footnotesOnPage laid them out again in the width of the section the page starts in. On a page where a continuous section with other margins refers to a footnote, the lines given broke at another width and took another height than the room left for them. The page now keeps the section its footnotes were last laid out in, and gives them in its width and from its left margin.