Skip to content

fix(docx): write a body panel's table indent even when it is 0 - #823

Merged
DemchaAV merged 1 commit into
2.5-devfrom
fix/docx-panel-zero-indent
Oct 2, 2026
Merged

DemchaAV merged 1 commit into
2.5-devfrom
fix/docx-panel-zero-indent

Conversation

@DemchaAV

@DemchaAV DemchaAV commented Oct 2, 2026

Copy link
Copy Markdown
Owner

Why

A container that paints exports as a one-cell table, and its w:tblInd places the cell's text, less half its left border (writePanelPiece: edge + padding − half the left border). The indent was written only when it was not 0.

IndigoProposal's about band takes its fill to the paper's edge with a negative left margin, and takes its text back to the page margin with an equal padding. So its indent is exactly 0, and nothing was written.

With no w:tblInd, Word 16 does not put the text on the margin. It puts the table's edge there, and the text a padding further in. Fill and text stood 27.6pt right of the page's, while the band's icons, drawn from the page, stood where the page has them. LibreOffice already set the band where the page does.

Measured by editing the exported DOCX by hand and converting it with Word 16.0.20430:

  • With no indent, the fill stands at 27.6 and "ABOUT" at 55.3.
  • With w:tblInd w:w="0", the fill stands at 0 and "ABOUT" at 27.6. The page has them at 0 and 27.7.

What changed

  • writePanelPiece writes the indent of a panel in the body even when it is 0. In a cell it keeps writing none at 0: there it is the table's outer edge, and Word starts a nested table no further left than the cell's text, so the two mean the same.
  • Docs. CHANGELOG.md, and an Indent bullet under "What a panel keeps and loses" in docs/recipes/docx-export.md.

Verification

  • IndigoProposal in Word: the 13 lines of the about band move 27.72pt left. "ABOUT KESTREL BUSINESS" stands at 27.63 against the page's 27.70.
  • No other document moves. Seven more documents now carry an explicit w:tblInd of 0: BlueBanner, BoxedSections (CV and letter), CompactMono, MinimalUnderlined and ModernProfessional (CV and letter). For each, the x of every line Word sets is unchanged, compared render to render. Their panels have no left padding, so 0 and none land alike.
  • The vertical gates do not move. The Word and LibreOffice corpus baselines are byte-identical.
  • Other body tables are not affected. Body tables and rows place their edge, through indentTable, which writes an indent wherever the inset is not 0. With no indent Word puts the edge on the margin, which is where they want it at an inset of 0.
  • New test, DocxPanelInsetTest.aPanelBledToThePaperEdgeWritesItsIndentOfNothing. A filled section with a −30pt margin and a 30pt padding writes w:tblInd 0 and a 30pt left cell margin. It fails without the change, where no indent is written.
  • Full reactor gate: ./mvnw -B -ntp clean verify -pl :graph-compose-core,:graph-compose-render-pdf,:graph-compose-render-docx,:graph-compose-render-pptx,:graph-compose-templates,:graph-compose-testing,:graph-compose-qa,:graph-compose-coverage -am gives BUILD SUCCESS. render-docx runs 820 tests, qa 1814.

Known limits

  • The fidelity gate measures lines down the page, not across. This fix is checked by the render comparison above, not by the gate.
  • No test pins that a nested panel at 0 still writes no indent.

Lane: shared-engine (render-docx). No public API change.

@DemchaAV
DemchaAV merged commit b514bf3 into 2.5-dev Oct 2, 2026
13 checks passed
@DemchaAV
DemchaAV deleted the fix/docx-panel-zero-indent branch October 2, 2026 22:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant