fix(docx): take a block's upward pull out of the space above it, and hold a row's padding at the top of its column - #793
Merged
Conversation
…hold a row's padding at the top of its column
…, and state the drift as measured
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
In Word,
PaymentsInvoicestood 10pt off its page, the worst of the 62 templates. There are two causes, and in both Word has nowhere to write space that the page has.applyVerticalSpacingwrites an edge only where it is positive. So the pull was dropped, and the rule, BILL TO and the line items stood about 10pt low: the 16.4pt pull less the 6.3pt the metadata grid lost above it.MerchantInvoice's metadata did the same.What changed
dispatchNode→standsIntoTheSpaceAbove. A paragraph's, page reference's or rule's negative top edge is added tocarriedSpacingBefore, the way a container's negative edge already is.newBodyParagraphthen nets it against everything owed above, as the page sums it.overTheFlowDepth > 0) is skipped: it is set in text boxes and owes no space.writeTableWithItsOwnSpacing. ARowNodeopening any cell except a table's composed cell now callsholdTheSpaceAboveATable, which writes a paragraph a tenth of a point tall. Before, it did so only at the top of a panel.holdTheSpaceAboveATablenow counts the containers' carried edges as well as the space owed.tablesCellsset filled inwriteCellContent. The table holds that row at the page's height; held again,ObsidianInvoice's line items stood 6pt low.aTableOpeningACellIsWrittenAsBeforeis narrowed to a row opening a table's cell: its ObsidianInvoice measurement was of line items in table cells. It is renamedaRowOpeningATablesCellIsWrittenAsBefore.CHANGELOG.mdanddocs/recipes/docx-export.mdare updated. The recipe's space-above-a-table paragraph now says where the hairline carries the space and where a table still loses it.Verification
./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 -amgives BUILD SUCCESS (1791 + 127 tests).extract-api --checkpass.DocxSpaceAboveTest(new, 5 tests):DocxOverTheFlowTest, 1 new test: a line pulled up in a text box takes nothing from the section's space above the flow after it.takeBackSpaceAbove, which cancels a container's pull;PaymentsInvoice: median 10.3 → 0.5pt, lines off 68 → 2.MerchantInvoice: lines off 38 → 27. Its metadata goes from -6.0 to +0.2pt and its totals from -9.9 to +2.1pt.MeteredInvoice,PlatformInvoiceandSubscriptionInvoicego to 0 lines off;WorkspaceInvoicegoes from 6 to 0.Known limits
resumeHereswaps in the space resumed there, as before this change.riseIntoItsLinerises only by the containers' pull). It stands that much less low than before.Lane: shared-engine (render-docx). No public API change.