Repository navigation
fix(docx): hold a drawing's room in a row nested through a one-layer stack - #822
Merged
Merged
Conversation
| : null; | ||
|
|
||
| assertThat(icon).isNotNull(); | ||
| for (XWPFParagraph paragraph : icon.getParagraphs()) { |
… CI, and rewrap the changelog entry
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
A row cannot sit in a row cell, so templates wrap one in a layer stack of one layer to nest it (
layeredRow). Nothing is laid over anything in such a stack, and the export writes the row in the flow, as a nested table.A drawing in that row — a
ShapeContaineror layer stack holding only drawing — is drawn where the page puts it, and takes no room in Word's flow. The export holds a drawing's room in the flow (holdTheSpaceOf), but only outside every overlay (overlayDepth == 0), and a one-layer stack counts as one.IndigoProposal's meta tiles and feature tiles are such rows: in each cell a disc or a rounded tile, then a label and a value. In Word and in LibreOffice every label stood a disc's or a tile's height higher than the page, 24.4pt for the meta tiles and 27.8pt for the feature tiles. Those are all 16 of the document's lines more than 2pt off.What changed
overlayDepth == oneLayerDepth) as well. There it does so only for a drawing with a later sibling in its parent (DocxLayoutMetrics.followedInItsParent).PaymentsInvoice's andWorkspaceInvoice's card heads. Its row is already held as tall as the page makes it (holdRowAtLeast). Measured on the corpus without this check, holding its room in its cell as well set the lines under those cards 0.24pt lower in Word.followedInItsParentlooks up the highest child index the layout placed under each parent, built once per section. The cheap checks come first, so only drawing-only nodes ask.word-windows,libreoffice-windowsandlibreoffice-linuxare rewritten forIndigoProposal, the one document this moves. The Linux one is taken from this PR's CI run (docx-fidelity-37068842402), where it goes from 16 lines past 2pt to none.CHANGELOG.md, and the drawing paragraph ofdocs/recipes/docx-export.md.Verification
Template corpus, re-measured in full. Only
IndigoProposalchanges, in both editors.What the gate reads as further from the page is a sign changing. Every line below the intro row moved down by 0.96 to 1.08pt in Word and by 1.05 in LibreOffice: in Word from between −0.04 and −0.97pt to between +0.01 and +0.98.
holdRowAtLeast), its right column 24pt short, and it ended 0.76pt short.New test class,
DocxNestedRowDrawingTest, two tests.Each rule fails its test when taken out.
overlayDepth == 0gate, the label has only its own 6pt.followedInItsParent, the lone disc's cell holds its room.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 -amgives BUILD SUCCESS. render-docx runs 819 tests, qa 1814.Known limits
followedInItsParentapplies inside one-layer stacks only. Outside every overlay a drawing alone in its section beside a heading still holds its room in its cell as before.inTheFlow,holdsARule, this branch), each comparing the overlay depth with the one-layer depth. Setting it once where the stack is entered would move everylayeredRowpreset, so it needs a corpus re-measure of its own.IndigoProposal's about band stands 27.6pt right of the page's in Word. The band's fill is at x=27.6 where the page has 0, and its text at 55.3 where the page has 27.7. That is horizontal, which the fidelity gate does not measure, and this change does not touch it.Lane: shared-engine (render-docx). No public API change.