Files
docx/scripts/layout-probes/word-column-widths.pdf
Dolan 27d9a41a27 feat(layout): break the lines of columns of different widths at each one's width, as Word does (#3614)
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.
2026-10-01 21:32:11 +01:00

39 KiB