fix(docx): end a bordered panel's right border inside its cell - #791
Merged
Merged
Conversation
Word draws a table's right border outside its right edge and, on screen, cuts off what passes its cell's edge and draws the cell's gridline there. A bordered panel reaching its cell's text edge now ends its right border and half a point short of it, the points taken from its right margin and no more than that margin holds, so its text keeps its place and width.
The containment test now includes the half point left for the gridline, and the wording of the change reads as its whole right border plus half a point short of the cell's text edge.
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
On screen in Word,
EditorialProposal's glance card had borders on three sides and none on the right. The card is a bordered panel written as a one-cell table inside the row cell that holds its column, and it is as wide as that cell.Measured through Word COM, three things combine:
What changed
writePanelPiece. A bordered panel in a cell that would reach its cell's text edge now ends its whole right border plusCLEAR_OF_THE_GRIDLINE_POINTS(0.5pt) short of that edge. The points it gives up come off its right margin, so its text keeps its place and width, and no more than that margin holds is taken. Past that the text would narrow and wrap, which is worse than a border the edge covers.CHANGELOG.mdand the nesting bullet ofdocs/recipes/docx-export.mdare updated.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). After install, examples are 93 green, and the knowledge checks andextract-api --checkpass.DocxPanelEdgeCasesTest(new):aNestedCardAsWideAsItsCellEndsItsRightBorderInsideItAndKeepsItsTextsWidthchecks two things: the table plus its whole 1.5pt right border ends inside the cell, and the text width is the one the card had before.aNestedCardWithTooThinAMarginGivesUpNoMoreThanItHoldscovers a card with 1pt padding: its right margin goes to 0 and its text width is unchanged.aNestedCardWithNoMarginStartsHalfItsBorderLeftOfTheCellstill pins the unchanged left edge. The filled pill inDocxComposedCellTest, which has no border, keeps its width.EditorialProposal:Lane: shared-engine (render-docx). No public API change.