You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(builder): ODT layout parity with DOCX (inherited spacing, space after a page break) #298
Found by porting a real-world template end to end (#292; epic #261, phase 4). The template matched the original in pages, words and fonts through a Stirling-PDF (LibreOffice) PDF path.
F10 — ODT: a derived paragraph style that sets one spacing loses the other · cosmetic, easy to hit
A style based on another that sets only SpaceBefore is written with only fo:margin-top. LibreOffice reads the top
and bottom margin of a style as one item, so the inherited fo:margin-bottom becomes 0. Measured: label to value
13.3 pt in the ODT against 15.3 pt in the DOCX, until the derived style restated both values.
Proposed change: when a style sets either spacing, the ODT writer writes both, resolved through BasedOn. The same
probably holds for start, end and first-line indent (not measured).
F11 — ODT: space above a heading at the top of a page after a manual page break · cosmetic
After PageBreak() a heading with 28 pt space before starts 28 pt lower in the ODT than in the DOCX. LibreOffice drops
that space for a DOCX and keeps it for an ODT.
Proposed change: write LibreOffice's compatibility settings into settings.xml so both formats lay out alike, or
document the difference in the support matrix. Which setting it is has to be confirmed; I did not test one.
F10. A derived paragraph style that sets only one of space before and space after now gets the other written from its parent chain. LibreOffice reads both as one item and lost the inherited value: 15.6 pt in ODT against 25.6 pt in DOCX, now equal. Start, end and first-line indents were measured and are already inherited correctly.
F11. This is not a compatibility setting. In a spike, AddParaTableSpacingAtStart in settings.xml changed nothing in six cases, and the two settings sets differ in no flag about this. The cause is LibreOffice's DOCX import: it writes margin-top 0 on the paragraph after a page break. The ODT writer now applies the same rule as a pass over the block tree, which removes the space before from:
the first paragraph, table (space before) or rule after a break;
the first block of every branch of a conditional there.
The pass does not go into loops (every copy would lose the space) or table cells (LibreOffice ignores a break there). The final review of the first version found exactly these four shapes (loop, cell, table/rule, else); the rework covers each with a test against the DOCX rendered by LibreOffice.
Known limits (documented):
Content that only becomes first because filling removed what came before it keeps its space in ODT.
The first loop iteration after a break keeps its space in ODT.
Activity
fix(builder): ODT spacing parity with DOCX (#298)
docs(builder): ODT spacing parity (#298)
fix(builder): top-of-page rule as a tree pass, after review (#298)
docs(builder): top-of-page rule after page breaks (#298)
vaceslav commentedon Dec 1, 2026
Done on
feature/builder(9bb5d0e..73571a9).F10. A derived paragraph style that sets only one of space before and space after now gets the other written from its parent chain. LibreOffice reads both as one item and lost the inherited value: 15.6 pt in ODT against 25.6 pt in DOCX, now equal. Start, end and first-line indents were measured and are already inherited correctly.
F11. This is not a compatibility setting. In a spike,
AddParaTableSpacingAtStartinsettings.xmlchanged nothing in six cases, and the two settings sets differ in no flag about this. The cause is LibreOffice's DOCX import: it writesmargin-top 0on the paragraph after a page break. The ODT writer now applies the same rule as a pass over the block tree, which removes the space before from:The pass does not go into loops (every copy would lose the space) or table cells (LibreOffice ignores a break there). The final review of the first version found exactly these four shapes (loop, cell, table/rule, else); the rework covers each with a test against the DOCX rendered by LibreOffice.
Known limits (documented):
vaceslav commentedon Dec 2, 2026
Done on feature/builder, merged to main in #316 and released in builder 0.1.0.