Repository navigation
Conversation
DemchaAV
force-pushed
the
fix/docx-write-zone-image
branch
from
October 8, 2026 05:02
d0fca92 to
7ab2307
Compare
…aws it A page zone is written as one line of a Word header or footer, and an ImageNode in it was not written: DROPPED, page zone content. It is now an inline picture in the line, at the size the page draws it - contained in its box or cropped to cover it - its link its run's. Word stands an inline picture on its line's baseline, so a picture that is the line's tallest part places the line by its foot, read off the layout's zone fragment, and the line is tall enough to hold it. Each one-line part the page sets on a baseline of its own - the text beside a logo, set from the logo's top, a smaller text beside a larger one, a page field - is raised or lowered to it by its runs' w:position, through the run loop seatInTheLine already used, now shared. The line grows to hold what is raised; a part is lowered only as far as the fifth of the line below the baseline holds, and one set lower stays counted. A line stopped at the page's edge raises its tallest part back onto the page's baseline. The report reads a picture as a part of the line and names what it loses: its transform, its outline entry and its anchor's bookmark. readAlike compares a picture's box, and the picture itself where a side is its own.
The body's writeImage and a page zone's picture fit a picture in its box, crop a covering one to it, and add it to a run the same way: addFittedPicture does it once for both. A zone's picture and an inline picture clear the file name POI describes a picture by through one describe. The body writes what it wrote before.
…keep zone parts off the body's lines A picture contained in a stated box is drawn as its own proportions fit it there, so a zone whose first page draws another picture in that box was read as alike, its line placed by the other picture's foot, and nothing named. readAlike now needs the same picture for a contained one, as for one whose side is left to its proportions. A zone's paragraph no longer reads the lines the body lays the same node out in: it is not seated by them, its pictures are not placed by them, and it is raised as the zone's line places it alone. A node used in the body and in a zone was raised twice, its note gone. A part's raise is written in whole half points - the nearest, or the next one towards the line's baseline where the nearest would pass the line's edge - and checked against what is written. A picture is lowered only as far as the line holds below its baseline: its foot is ink.
DemchaAV
force-pushed
the
fix/docx-write-zone-image
branch
from
October 8, 2026 07:38
7ab2307 to
359217f
Compare
DemchaAV
marked this pull request as ready for review
October 8, 2026 07:38
This branch has not been deployed
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 page zone is written as one line of a Word header or footer. An
ImageNodein it — a header's logo — was not written:warnUnsupportedZoneNodenamed itDROPPED,page zone content. Word holds a logo in a header as an inline picture on the header's line.Writing it alone moves the text beside it. Word stands an inline picture on its line's baseline, so the logo, as the line's tallest part, places the line by its foot. The page sets the text beside a logo from the logo's top, or its middle. On the logo's foot that text stood 9 to 18pt low, where before it had stood on the page's baseline.
What changed
A zone's picture is written in its line (
appendZonePart→writeZonePicture). It is an inline picture at the size the page draws it, throughaddFittedPicture, which the body'swriteImagenow shares (its own commit, the body's output unchanged):applyCoverCrop);newRun(para, linkTarget));describe, shared withwriteInlinePicture.The picture is a part of the line's placement (
zonePlacement,pictureOnThePage). It stands on its drawn foot, read off the layout's zone fragment (DocxLayoutMetrics.zonePictures) with the drawn rectangleDocxClipInk.drawnalready computes for a contained picture. As the tallest part it places the line by that foot, and the line is tall enough to hold it: four fifths of it above the baseline.In a zone of one line, each one-line part Word sets as the page does stands on its own baseline (
ZonePlacement.raised, written inwriteZoneLine):w:position, throughraiseRunsFrom. That is the loopseatInTheLinealready used, now shared, so it also reaches a run inside an internal link;writingAZoneLine): it is not seated by them (seatInTheLine), and its pictures are not placed by its body line. A node used in the body and a zone is raised as the zone's line places it alone.reportZoneLinereads a picture as a part:A picture's own losses are named (
zonePictureLost): its transform, its outline entry, its anchor's bookmark.DocxZoneParts.readAlikecompares a picture's box (samePictureBox): its stated sizes, fit and insets. Where its own proportions set what is drawn — a side left unstated, or a picture contained in its box — it also needs the same picture, the same file or bytes. A zone whose first page draws another box or picture there is written, and where it stands is named not measured.Anything else in a zone — a shape, a barcode, a container — is still
DROPPED,page zone content; the message now lists pictures among what a zone is written from.Verification
./mvnw -B -ntp install -pl :graph-compose-render-docx→ BUILD SUCCESS, 1267 tests, 0 failures, 1 skipped.DocxZonePictureTest(24):DocxZoneLineTest:DocxZoneReportTest: parts on baselines of their own, a page field among them, no longer counted. A part set lower than the line holds is still counted.DocxReportedLossesTest: a shape in a zone is stillpage zone content, named once though written into two headers, and per section; a picture is not named.readAlikecomparison, the contained case included.DocxPageZoneTestamong them: 50/0.2.5-dev, its body pictures written through the sharedaddFittedPictureincluded. Report notes: 954, unchanged.Known limits
w:positionsays: 8pt text raised 18pt stood 2.3pt high. It does not raise a page field at all, so a page number beside a taller logo stands on the logo's foot there. It also stands every picture on the line's baseline, so a picture that is not the line's tallest part is not raised there. Word, the reference editor, sets each where the page does.Lane: render-docx (DOCX semantic backend) — no public API change.