fix(docx): take a panel's top border inside it when no space above can, and hold the body at a margin a band reaches past - #799
Merged
Conversation
…n, and hold the body at a margin a band reaches past
…it only where its padding cannot hold them, and leave a framed band's margin as 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
MerchantInvoiceis one page in the PDF and two in Word, its footer row alone on the second page. The page sets that row down to its 3.4pt bottom margin, so any growth above it pushes the row over. Two things grew it.What changed
writePanelPiece/takeTheTopBorderInside.topNotTakenis what of the top border the space above could not give.topNotTaken − padding.toplow: a padding as wide as the border holds it.topNotTakenplus the bottom border, less the heavier of the two, whichholdRowAtLeastalready takes off for LibreOffice. A padding that holds the border leaves the height as it was: Word draws the border inside the margin.CompactMono, 9pt of padding round a 0.375pt border) gives nothing: Word draws the border inside the margin.placeBand/reachesPastTheMargin. A text band alone of its kind that reaches past the page margin, by more than a twentieth of a point, writes that margin negative. In OOXML a negativew:top/w:bottomholds the body at the margin whatever the header or footer reaches, which is what the page does. A margin of none is written as a twentieth of a point. A framed band (one sharing its kind with another band or a page zone) is left as it was. The report note says so, and that LibreOffice still moves the body clear. The grace before a band counts as past the margin is now a twentieth of a point rather than a point, so a band up to a point past it is written negative and noted too.CHANGELOG.md, the panel paragraph and the header/footer paragraph ofdocs/recipes/docx-export.md, and the panel and header/footer rows ofdocs/architecture/backend-capability-matrix.md.Verification
./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 -amgives BUILD SUCCESS (1791 + 127 tests).DocxPanelHeightTest(+3).DocxTextBandTest(+5).2.5-dev: four documents change.MerchantInvoice: one page in Word, from two. p90 drift in Word 1.64pt → 0.76; in LibreOffice 1.56pt → 0.67.ObsidianInvoice: p90 drift in Word 1.59pt → 0.61. In LibreOffice, lines more than 2pt off 7 → 0.PlatformInvoice: p90 drift in Word 0.65pt → 0.40.SubscriptionInvoice: its footer reaches past its margin too. It stays one page, its drift unchanged.Tried and dropped
w:framePr) round the footer band. Word still moved the body clear of the frame, and the document stayed two pages.Known limits
MerchantInvoiceis still two pages there, as it was.DocumentPageZone) reaching past the margin is neither written negative nor reported, as before.Lane: shared-engine (render-docx). No public API change.