Repository navigation
fix(docx): name a block Word may break inside a panel it moves down in - #932
Merged
Merged
Conversation
Inside a panel the layout runs over a page break, a block it keeps whole or with the next moves to the next page, but Word and LibreOffice break the panel's row where its lines run out and hold no keeps across that break. Measured in both, a stack of three lines or a section kept together moved whole to the next page stood with two of its lines at the foot of the page above, and a heading kept with the line under it stood there alone. Nothing was named. The report now names such a block. A filled section kept together and a row, which Word moves whole, are not named.
DemchaAV
marked this pull request as draft
October 20, 2026 20:52
A block moved whole inside a panel was named even where Word cannot split it: one line, one picture, a drawing, a row that may not split. It is now named only when it wrote at least two pieces Word may set on different pages, counted after it is written; a painted section kept together, whose own row may not split, is one such piece. A shape container the layout moves whole is named as a stack is, and a painted section kept together and with the next is named as kept with the next, which Word may leave behind.
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 painted section or container (a panel) is written as a one-cell table, and its row may break
over a page unless the panel is kept together on one page. Inside a panel that the layout runs
over a page break, the layout moves a block it keeps whole, or a block kept with the next, to
the next page. Word and LibreOffice break the panel's row where its lines run out instead.
Measured in Word 16 and LibreOffice on Windows, inside a filled section ("p" = page):
Nothing was named.
Keeps cannot fix it. With
w:keepNextwritten on the stack's paragraphs in the panel's cell,both editors broke the row in the same place, so the block is named rather than written. Writing
such a panel in pieces at the layout's break is a separate step. That step would also fix the
4.7pt the panel's text stands low on the next page.
What changed
keepThePanelMayBreak, before a block is written inwritePlacedNode, makes it acandidate when:
A candidate moves the panel's page on, so what it holds is not a candidate again.
reportAKeepThePanelBreaks, after the block is written, names (APPROXIMATED) acandidate:
(
piecesWordMaySplit). A piece is a paragraph that shows something, or a row: one for a rowthat may not split, otherwise as many as its tallest cell holds.
So one line, one picture, a drawing or a row that may not split is not named, and a painted
section kept together, its own row one that may not split, is not either.
panelLastEndPageis the panel's page:writeNodeupdates it;writePanelPiecekeeps it across a panel written straight into another, whose row breaksbefore it too, and resets it for a panel in any other cell (a row's or a column's);
fresh, and reset per export.
Docs:
in a panel carry as anywhere else;
Verification
are identical.
word-export-companion.docxwas regenerated. It differs from the committed one onlyin
docProps/core.xml, the export's time.no DOCX changes.
DocxPanelKeepReportTest(new, 16 tests). Each note is checked by its node's path, andeach "not named" case first asserts the page the block starts on.
./mvnw -B -ntp clean verify: BUILD SUCCESS.javadoc passes with no warnings.
Lane: render-docx (semantic backend), report only. No DOCX bytes change.