Repository navigation
fix(docx): name a panel's right border held in from its cell's edge - #939
Merged
Merged
Conversation
Word draws a nested table's right border outside the table and, on screen, cuts off what passes its cell's edge. A bordered panel reaching that edge is written narrower, out of its right margin, its border up to its width and half a point in; where the margin is too narrow, as a shape container's always is, the rest still passes the edge. Nothing in the report said either. The panel's note (right border) now names how much nearer its text the border is written and what of it still passes the cell's edge, past the cell's own right margin. A painted row and a shape container written as a panel are named the same way. The ledgers held the case as a gap; every entry it reaches is now reported, and the case leaves the list of known gaps.
DemchaAV
marked this pull request as draft
October 22, 2026 00:25
The right-border note named how much nearer its text the border was written by the points its table gave up. Those points include the editor's slack a panel sized round its content is given past the page's width, and, where the right margin is too narrow, the left side's give back moves the border further out, not nearer. The note now names how much narrower than the page draws the panel its table is written, the slack not counted (panelWidth returns it), and about how far the border still passes the cell's edge, reckoned too in a cell too narrow to take any of it in. Docs and the ledger state the narrowing as the code takes it: the border ends half a point short of the edge.
DemchaAV
marked this pull request as ready for review
October 22, 2026 00:43
| private static double held(DocxExportReport.Note note) { | ||
| Matcher held = HELD.matcher(note.detail()); | ||
| assertThat(held.matches()).as("the note: %s", note.detail()).isTrue(); | ||
| return Double.parseDouble(held.group(1)); |
| private static double[] notHeld(DocxExportReport.Note note) { | ||
| Matcher past = NOT_HELD.matcher(note.detail()); | ||
| assertThat(past.matches()).as("the note: %s", note.detail()).isTrue(); | ||
| return new double[]{past.group(1) == null ? Double.NaN : Double.parseDouble(past.group(1)), |
| Matcher past = NOT_HELD.matcher(note.detail()); | ||
| assertThat(past.matches()).as("the note: %s", note.detail()).isTrue(); | ||
| return new double[]{past.group(1) == null ? Double.NaN : Double.parseDouble(past.group(1)), | ||
| Double.parseDouble(past.group(2))}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Word draws a nested table's right border outside the table and, on screen, cuts off whatever passes its
cell's edge. A bordered panel in a table cell is a nested table. When its right border reaches the cell's
text edge,
writePanelPiecewrites the table narrower, out of the panel's right margin and no more thanthat margin holds, so the border ends half a point short of the edge and the text keeps its place and
width. For a panel as wide as its cell, that is half of each side's border, the whole border and the half
point: 3.5pt for a 1.5pt border.
Neither outcome was in the report:
shape container written as a panel is always in this case: its padding is set round its outline.
The field ledgers held the case as a known gap.
The corpus has 28 such panels. 19 are written narrower. Measured in Word on Windows, their right borders
stood:
The other 9 pass the edge, by about 1.0 to 1.7pt:
In Word's PDF the outlined chips' right border is drawn whole, about 0.75pt right of the page's, so the
cut is a screen one.
What changed
DocxSemanticBackend.writePanelPiecenames both outcomes on a panel's first piece, in oneAPPROXIMATEDnote with subjectright border(rightBorderHeldIn):out of its right margin, so its right border, which Word draws outside the table, ends short of its
table cell's edge, past which Word cuts it off on screen".
panelWidthgives a panel sized round its content past the page's width, so itis not narrower than the page.
panelWidthnow returns that slack with the width (PanelWidth).edge, where Word cuts it off on screen", after the narrowed clause where there is one.
it.
it, and the half point left clear of the gridline are taken off first.
Ledgers: every entry this case reaches moves from
GAPtoREPORTED:ContainerNode,SectionNodeandRowNodestrokeandborders;ShapeContainerNode.stroke;DocumentStroke.widthandDocumentBorders.right.RIGHT_BORDERnow states the narrowing and what is named, and leaves the list of known gaps, so aGAPnote that still opens with it fails the ledger.
Docs and CHANGELOG:
Verification
DocxPanelRightBorderTest(new, 11 tests). The figures are pinned to the geometry, worked out byhand in each test, and the narrowed one also against the written
w:tblW.GAP;GAP.ones are all
right border../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→ BUILD SUCCESS (render-docx 2000 tests, qa 1828). The JDK 17 checks pass: the knowledge pack,
@Betastability doc, claims and routes, and core javadoc with 0 warnings.
Notes for review
layout addresses that content under its table. Every note on such content shares this, and so do the
7 rota-cobalt notes.
the border is drawn whole.
roomends at the cell's text, so a panel whose border the cell'sown right margin would hold is narrowed all the same. The note is still true there. Changing that
changes the DOCX, which this PR does not.
Lane: shared DOCX backend (
render-docxreport). No public API change; the DOCX bytes do not change.