mirror of
https://github.com/dolanmiu/docx.git
synced 2026-11-30 16:47:55 +01:00
Word breaks each column's lines at its own width, so a paragraph that goes on into a column of another width is broken again there, and evens out columns of different widths by height (word-rules2.docx Q7). docx/layout broke a paragraph's lines once, at one width, so it stopped at columns of different widths. Each line can now have its own width in layoutLines, and the layout breaks a paragraph's lines column by column: the part of it that goes on into a column of another width, after a column break or where it doesn't fit, is broken again at that column's width. Paragraphs kept with the next are measured at the width of the column they move to. A paragraph kept together that is taller than one of columns of different widths stops the layout, as how Word lays one out down the first column of each page (#3607) isn't known for them. A probe saved from Word (scripts/layout-probes/word-column-widths.ts) settled the rest: - Widow control counts the lines left for the next column as they are broken in the column before. 2 narrow lines left go on 1 wide line, alone at the top of the wide column, and 1 wide line left moves a line with it, though it would go on 3 narrow ones. LibreOffice counts them as they are broken in the next column, and moves lines until 2 are there. - A table sized to its text keeps the widths it has in a narrow column in a wider one, given no width or 100%. What Word does in a narrower column, where they might not fit, isn't known, so the layout stops there.
39 KiB
39 KiB