Repository navigation
fix(docx): keep the room a contained picture leaves in its box - #926
Merged
Merged
Conversation
The page draws a picture contained in its box in the box's middle. The export embedded it at its fitted size and nothing else: measured in Word and LibreOffice, a 200x100 picture fitted to a 100pt square stood at the square's top, and the paragraph under it 51pt high. Half the room it leaves above and below is now its paragraph's space, written with its margin and padding, and half at its side its indent. In a band, which owes the space below it from the box, the room below is the paragraph's own space after.
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
The page draws a picture contained in its box (
fitToBounds,CONTAIN) in the box's middle(
PdfImageFragmentRenderHandler). The DOCX export embedded it at its fitted size and nothing else,so the room it leaves in the box was lost.
Measured in Word 16 and LibreOffice on Windows, a 200×100 picture fitted to a 100pt square:
Nothing was named. The point left over on the paragraph under it is Word's own: "Before", above
the picture, stands 0.9pt higher too.
What changed
roomRound: the room a contained picture leaves round it in its box, half on either side, asthe page centres it. The fitted size comes from
containedIn, whichaddFittedPicturenow usestoo.
writeImage:applyVerticalSpacing, with the picture's margin andpadding, so a pull from the block before comes out of it as out of them.
holdInAcross), on top of the insetsthat hold the box in.
room below. There the room below is written as the paragraph's own space after.
writeImageJavadoc;Verification
addAligned: x 175–225, as the page;named (
overlapping layer), and the paragraph under the band follows it by that much (12pt).identical.
word-export-companion.docxwas regenerated. It differs from the committed one onlyin
docProps/core.xml, the export's time.DocxContainedPictureTest(new, 8 tests):./mvnw -B -ntp clean verify: BUILD SUCCESS (core 821, render-docx 1849, examples 93, qa 1820).The knowledge pack's
--checkpasses.Two things this leaves as they were, each a separate step:
moves to a new page stands 25pt high in both editors, as its margin above already did.
column, while Word holds it to its 100pt bounds.
Lane: render-docx (semantic backend). DOCX output changes only for a picture contained in a box
it does not fill.