Skip to content

fix(docx): end a bordered panel's right border inside its cell - #791

Merged
DemchaAV merged 2 commits into
2.5-devfrom
fix/docx-panel-in-cell
Sep 30, 2026
Merged

DemchaAV merged 2 commits into
2.5-devfrom
fix/docx-panel-in-cell

Conversation

@DemchaAV

@DemchaAV DemchaAV commented Sep 30, 2026 •

Copy link
Copy Markdown
Owner

Why

On screen in Word, EditorialProposal's glance card had borders on three sides and none on the right. The card is a bordered panel written as a one-cell table inside the row cell that holds its column, and it is as wide as that cell.

Measured through Word COM, three things combine:

  • Word's PDF. Word draws a table's right border outside the table's right edge: a table ending at 566.0pt printed its right border from 566.2 to 566.9.
  • The panel's width. The panel is written half a border wider on each side than its box, and a nested table's negative indent is ignored. So the card ran past the cell's edge.
  • Word on screen. Word cuts off what passes the cell's edge and draws the cell's gridline there. A screen capture of Word's window showed the fill running straight into the gridline.

What changed

  • writePanelPiece. A bordered panel in a cell that would reach its cell's text edge now ends its whole right border plus CLEAR_OF_THE_GRIDLINE_POINTS (0.5pt) short of that edge. The points it gives up come off its right margin, so its text keeps its place and width, and no more than that margin holds is taken. Past that the text would narrow and wrap, which is worse than a border the edge covers.
  • Scope. A panel without a right border, a panel narrower than its room, and panels in the body are written as before. Its left edge and indent are unchanged.
  • Docs. CHANGELOG.md and the nesting bullet of docs/recipes/docx-export.md are updated.

Verification

  • 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 (1791 + 127 tests). After install, examples are 93 green, and the knowledge checks and extract-api --check pass.
  • DocxPanelEdgeCasesTest (new):
    • aNestedCardAsWideAsItsCellEndsItsRightBorderInsideItAndKeepsItsTextsWidth checks two things: the table plus its whole 1.5pt right border ends inside the cell, and the text width is the one the card had before.
    • aNestedCardWithTooThinAMarginGivesUpNoMoreThanItHolds covers a card with 1pt padding: its right margin goes to 0 and its text width is unchanged.
    • Each fails with its part of the change removed.
  • Existing tests: aNestedCardWithNoMarginStartsHalfItsBorderLeftOfTheCell still pins the unchanged left edge. The filled pill in DocxComposedCellTest, which has no border, keeps its width.
  • Word, EditorialProposal:
    • On screen, the card now shows fill, border, a white gap, then the cell's gridline on its right.
    • In Word's PDF, its right border is at 564.2–565.0pt, 0.35pt inside the edge of its cell at 565.3pt (before: 566.2–566.9, past it).
    • Its text stands at 435.4pt as before, with no new wraps and the same height.
    • The 62-template corpus is unchanged in Word: median drift 0.56pt, 858 lines more than 2pt off.

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

Word draws a table's right border outside its right edge and, on screen, cuts off what passes its cell's edge and draws the cell's gridline there. A bordered panel reaching its cell's text edge now ends its right border and half a point short of it, the points taken from its right margin and no more than that margin holds, so its text keeps its place and width.
The containment test now includes the half point left for the gridline, and the wording of the change reads as its whole right border plus half a point short of the cell's text edge.
@DemchaAV
DemchaAV merged commit 5205b36 into 2.5-dev Sep 30, 2026
12 checks passed
@DemchaAV
DemchaAV deleted the fix/docx-panel-in-cell branch September 30, 2026 14:21
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