Repository navigation
fix(docx): end a panel hung out of its cell where the page ends it - #947
Merged
Merged
Conversation
- A panel whose left border the page centres on its cell's text edge is written with a negative indent, its table half that border wider. LibreOffice and Word start a nested table half that border in from the cell's text, so its right end stood the whole border right of the page's. It gave up width only where it then ran past its cell. - It now always gives up what its left side gave its text, no more than the editors move it, counting what holding its right border in has taken. A bled panel keeps its bleed. - What the cell does not take goes back to the table, not the margin, for a line set past its text further than the margin holds, and the panel is named wider (right end). - Measured on Windows: Compact Mono's rail +0.90/+0.86 to +0.06/-0.04; bordered cards +0.35..0.64 to +0.09..0.35; synthetic rails +3.0 to within 0.14; no word moves in either editor. - Tests: a hung card taking the hang back for its lines, one filling its column keeping what the cell takes, a bled card, a card set in half a point; three updated to the new widths.
DemchaAV
marked this pull request as draft
October 23, 2026 08:03
- The javadoc of whatTheHangGivesUp names the three cases where a hung panel's text keeps more than where nothing holds its right border in. The first is holding the border in taking less than the hang gives, which no corpus document meets. The second is the cell's margin holding the border, as for the cards beside a gap of Panel, Metered, Obsidian and Workspace, none of which changes. The third is a line taking the hang back. - It says the give-up is measured with the border on the cell's text, and reckoned from that for a panel set in or bled. It also says the left edge note counts from the border's outer edge. - The CHANGELOG and the recipe give the bordered cards' range apart: 0.24 to 0.35pt in Word, and 0.09 to 0.22pt in LibreOffice. - A gap card test names its text width for what it is.
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
In a table cell, the page centres a panel's left border on the cell's text edge, half of it outside. The export writes that panel with a negative
w:tblInd(−half the border), and its table is half that border wider than the panel. LibreOffice and Word start a nested table half that border in from the cell's text, its border's outer edge on the text, so the table stood its whole left border right of where it is written. Its right end stood the whole border right of the page's.whatTheHangGivesUpgave up width only where the table then ran past its cell. The report named the left edge (left edge), but nothing named the right end.Measured on Windows:
What changed
whatTheHangGivesUpalways gives up what the panel's left side gave its text (hangGiven): the half border the table is wider by, plus what its left margin gave back of the other half. Its right end then stands where the page's does.halfLeft − indent). A panel set in less than half its border from the cell's text is moved less than the whole border.pullOf) counts towards it (max(what runs past the cell, given − pulled)).pageWide, which caps theright endnote, is reckoned the same way.whatTheHangSpares,hangBack), for a line set past its text further than its margin holds.measureAtWordsSize,noteTheLinesPast). Without it, Engineering Resume's role card lost the stop ending a line in both editors.whatTheHangMustGiveUp) never goes back.right end), and its third role card at 3pt where it said 1pt. Its fill stands 3.22pt right of the page's in Word.left edgenote is unchanged.whatTheHangGivesUpand of the slack give-back;RIGHT_END.Verification
DocxPanelSlackTest(+4 new, 3 updated):pageWidewithout the border's narrowing;./mvnw -B -ntp clean verify -pl <core, render-pdf, render-docx, render-pptx, templates, testing, qa, coverage> -am→ BUILD SUCCESS: core 821, render-pdf 339, render-docx 2072, testing 5, render-pptx 142, templates 127, qa 1828../mvnw -f examples/pom.xml test→ BUILD SUCCESS, 93 tests.Notes for review:
whatTheHangGivesUpnames them:hungMore). The cards beside a gap in Panel, Metered, Obsidian and Workspace meet it, and keep the width they had before. None of their documents changes.Lane: shared-engine (render-docx): no public API change.