Repository navigation
fix(docx): name what of a paragraph's pull up nothing gives back - #940
Merged
Merged
Conversation
Word has no space above a paragraph below zero. A paragraph's, a page reference's or a rule's top edge below zero comes out of the space owed above it, and a paragraph's off the foot of the one line above it and the top of its own line; what none of them gave was dropped without a note. standsIntoTheSpaceAbove now names the block's own pull left after every gift (space above), a container's edge carried down and a border below the block above aside: in the flow the block and what follows stand that much lower, in a table cell up to that much, its row as much taller where the cell sets it. The first block of a resumed layer and a block opening a page in the flow are not reckoned here yet, and stay a narrowed gap in the ledger. riseInsideItsOwnLine returns what it took.
DemchaAV
marked this pull request as draft
October 22, 2026 09:12
A block after a page break opens its page with nothing above it there: its pull is no longer named as set over a block above. A side of an overlay's line pair takes its pull out of the space above alone and is not named; the ledgers, the recipe, the matrix and the CHANGELOG say so, and the value ledger's top inset carries the narrowed gap too. riseInsideItsOwnLine keeps its void shape, the remainder being read from the space owed.
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
Word has no space above a paragraph below zero. When a paragraph's, a page reference's or a rule's top
edge is below zero,
standsIntoTheSpaceAbovetakes it:takeFromTheLineAbove) and offthe top of its own line (
riseInsideItsOwnLine).What none of them gave was dropped with nothing in the report. The field ledger held it as a known gap.
The corpus has a top below zero in 10 documents. Line-by-line drift between the engine's PDF and Word's
PDF shows one visible loss:
TealPulse's 4 contact pairs. Each is pulled 4.32pt up in a centred row, a2.16pt lift on the page, and its line holds an icon, so it cannot rise inside it. In Word the pairs stood
1.2pt lower. The other 9 documents' lines stand within 0.75pt of the page's around those blocks.
Writing the pull as space below the pairs was tried, since that shifts a centred paragraph as much. The
pairs rose 0.8pt, but the row grew past the page's and the page under it stood 2.2 to 2.8pt lower in
Word. So the remainder is named, not written.
The corpus's one bottom below zero, Luma's closing banner, is the last block of its document. Nothing
follows it, and Word draws the same number of pages, so nothing is lost there.
What changed
DocxSemanticBackend.standsIntoTheSpaceAbovenames what is left of the block's own pull, under thesubject
space above(nameAPullNotGivenBack):It is worked out after every gift:
min(−edge, −(carried + pending)).In the flow, the existing wording: "it stands Xpt lower than the page sets it, and what follows
with it: the page sets it Xpt over the block above it, and Word sets no block over another".
In a table cell: "…it stands up to that much lower than the page sets it, and where its cell
sets its row's height, the row is that much taller". The page sets the cell's content that much
shorter, and how far that moves the block depends on the cell's alignment and on which cell sets
the row.
Not named (
spaceAboveWrittenElsewhere), since the space Word writes there is reckonedelsewhere:
distance from what is above it;
after a page break;
(
writeLinePair).The ledger keeps those as a narrowed gap,
PULL_UNRECKONED.ParagraphNode,PageReferenceNodeandLineNode(as a rule)marginandpaddingmovefrom the broad
TOP_PULLgap to the narrowedPULL_UNRECKONEDone, with the rest reported(
PULLED_UP).TOP_PULLstays a gap for the other blocks. The value ledger'sDocumentInsets.topadds the narrowed gap and the named rest to its
TOP_PULLgap.DocxPanelTailTest.aParagraphPulledUpStandsBelowNoBorderkeeps its point: a pull is no panel'sborder. It no longer expects no
space abovenote at all. It now pins the two pulls nothing givesback: the flow one, and the cell one at 4pt, neither naming a border.
the CHANGELOG (Public API).
Verification
DocxTopEdgePullTest(new, 14 tests). The paragraphs run to two lines or more, so no line givesanything unless a test means it to.
next page;
pairs at 4.32pt, and Obsidian's wordmark at 0.1pt.
./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 -am→ BUILD SUCCESS (render-docx 2014 tests, qa 1828). The JDK 17 checks pass: the knowledge pack,
@Betastability doc, claims and routes, and core javadoc with 0 warnings.
Lane: shared DOCX backend (
render-docxreport). No public API change; the DOCX bytes do not change.