Repository navigation
fix(docx): close a document ending in a table with an ordinary paragraph where its last page has room - #848
Merged
Merged
Conversation
…aph where its last page has room
…at a page background takes no room from it
…osing paragraph is a hairline
…s measured, in words for the section it closes
…aragraph # Conflicts: # CHANGELOG.md
…aragraph # Conflicts: # CHANGELOG.md
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 requires a paragraph after a closing table. The export always wrote that paragraph a point tall, with its mark hidden, so that it could never open a blank page under a full one. That made the end of every such document impossible to type at. 33 of the 62 corpus documents end in a table.
Measured in Word on
CompactMono:The editing protocol (#847) failed "type at the end" on all 33 documents.
What changed
DocxSemanticBackend.dropTheSpaceAtTheEndnow writes that paragraph as an ordinary one when the section's last page has room for it.roomBelowTheFlowtakes the bottom of the lowest content fragment on the last page, less the bottom margin. Fragments under a path of the layout's own (@page-background,@page-zone…,@timeline-rail) are drawn elsewhere and do not count.roomForAClosingLine): one line for the paragraph and one to spare for an editor setting the content above lower than the page does. Where the document has a dominant text style, Normal is written in that size, so the ordinary paragraph is Normal's line; where it has none — all its text in tables — 12pt is assumed.APPROXIMATEDunderclosing paragraph, naming the section in a document of several. The note says where text typed there goes: into the table's last cell or the hidden paragraph at the document's end, onto point-tall lines in an earlier section. In the corpus these pages are filled to 0–16pt above the foot, where an ordinary line could open a blank page, in LibreOffice first.roomBelowTheFlowNaN): the hairline stays, and noclosing paragraphnote is added, since the section's "could not be laid out" note already says why.hideTheClosingMark) now applies only to that hairline (hairline(paragraph, points)), so an ordinary closing paragraph keeps a visible mark. Before, any empty paragraph after the closing table was hidden; one that is not the hairline — a rule drawn in a fully transparent colour, an empty paragraph with an exact line and no border — now keeps the height the layout gave it. The cell separator check uses the same helper, with its behaviour unchanged.The recipe ("Measured geometry"), the capability matrix's table row and CHANGELOG are updated. Javadoc that described the paragraph as always a point tall now says when it is.
Verification
2.5-devthe typed lines ran into the closing table's last cell in all 17; now they run below the table onto a new page, visible at the body size. The other 16 documents ending in a table keep the hairline and are reported.scripts/docx-visual/word-fidelity.ps1 -Update→ BUILD SUCCESS, baselines unchanged: no line moved and no page was added.DocxFidelityCorpusTest -Dgraphcompose.docxFidelity=libreoffice→ BUILD SUCCESS against the committed baseline.DocxVerticalSpacingTest:closing paragraphonly in the first case;DocxPanelHeightTestandDocxMultiSectionTestkeep their hairline assertions on a table pushed to the page's foot by a spacer.DocxMultiSectionTest: a middle section whose table leaves room below closes with an ordinary paragraph, and that paragraph carries the section's properties.@fragments as content: 1 test fails../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 (qa 1820 tests).CommittedAssetDriftTest→ 3 / 3 green.Notes
Lane: shared-engine (render-docx).