Repository navigation
fix(docx): keep a row's fixed columns at their widths when they leave the rest of the row empty - #817
Merged
Merged
Conversation
… the rest of the row empty
…and pin the row's padding and full-width tables
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 row whose columns are all fixed, and add up to less than the row, leaves the rest of the row empty on the page. The last column's text wraps at that column's own width.
In DOCX the last column ran to the row's edge.
EditorialProposal's deliverables are a 262.8pt column and a 193.8pt one in a 535pt band. The second came out 272pt wide (w:gridCol5449). Word set "Responsive design for desktop, tablet & mobile" on one line where the page wraps it, so every item under it stood a line, 12.3pt, higher.The same rows set the scope of work's descriptions on the first page (
EditorialPageOne, three fixed columns) andPaymentsInvoice's item text (a fixed disc and a fixed text column): their last column wrapped later than the page in the same way. These account for six ofEditorialProposal's eight newly found lines and all four ofPaymentsInvoice's.What changed
holdTheLastFixedColumn. Where a row's last column is fixed, the column keeps its stated width (with its cell margins) and does not run to the row's edge. The column starts where its child does, past the child's left margin, so that margin is taken out of the held width. It applies on the path where the layout placed the row's children (placedColumns).applyRowGeometry: the table is no wider than its columns. That holds on both paths, placed and stated. A row whose columns fill it is written as before.word-windowsandlibreoffice-windowsare rewritten for the documents this moves.CHANGELOG.md, and the Rows row ofdocs/recipes/docx-export.md.Verification
Template corpus, re-measured in full against
2.5-dev's baselines. Both gates pass.EditorialProposalPaymentsInvoiceEditorialProposalPaymentsInvoiceNo other document changes in either editor.
EditorialProposalin LibreOffice stands 42–46pt off on its second page for a cause of its own. Two of its eight newly found lines are past 2pt with the rest of that page. No line it found before moved further.New test,
DocxRowLayoutTest.fixedColumnsNarrowerThanTheRowLeaveTheRestOfItEmpty. A 100pt and an 80pt column in a 360pt row are written 2000 and 1600 twips, in a 3600-twip table. It is checked with the layout and without it.New test,
DocxRowLayoutTest.aLastFixedColumnHoldsItsChildsMarginInsideItsWidth. An 80pt last column whose child has a 10pt left margin is written 1400 twips.New test,
DocxRowLayoutTest.fixedColumnsNarrowerThanTheRowKeepItsPaddingAtTheirOuterEdges. With 12pt of row padding, the columns are 2240 and 1840 twips, the last cell's right margin is 240, and the table is 4080. Both paths are covered.Rows whose columns fill the row keep the table at the row's width.
aFixedColumnTakesItsWidthAndAWeightTakesTheRestasserts 7200 twips, andDocxEditorSlackTest.aRowWithNoAutoColumnIsWrittenAsPlacedasserts the placed width.One expectation changed, and the test renamed:
DocxEditorSlackTest.aRowWithNoWeightColumnHasNoPointToGiveItsFixedColumnAtItsWidth. Its row is an auto column and a fixed 80pt one. The fixed column is now written 1600 twips, at the width the layout gives it, where the test held it to the row's edge.Each rule fails the test when taken out.
holdTheLastFixedColumn, the laid-out row's last column runs to its edge.Full reactor gate:
./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. render-docx runs 794 tests, qa 1814.Known limits
EditorialProposal's timeline table still stands up to 2pt low in Word. A table text cell's line holds the line gap, and its text is not seated on the page's baseline: the first line of a wrapped cell stands about 1.2pt low. That is its own change.Lane: shared-engine (render-docx). No public API change.