Repository navigation
fix(docx): grow a table text cell's lines where they are as tall as its face's own - #956
Merged
Merged
Conversation
…ts face's own - A table text cell's paragraphs are written at a least height where each may grow (DocxGrownLines.mayGrow) and Word then stands the text within a quarter point of the page's (letTheCellsLinesGrow), as a paragraph's lines are. In the faces the export ships a least cell stands where the page does, so its row keeps the padding as its margins and no line is traded for the space after it. - belowThePage reads Word's seat through DocxGrownLines.lineOf, an exact line's or a least one's. - A cell tighter than its face's own, in a face the document does not ship, or set right to left stays exact; beside a least cell, an exact cell is left the rest of its call, for its position and line heights. - Tests: least cells at three anchors, a paragraph a line and lines broken in one paragraph, Poppins and right-to-left cells exact, an exact cell beside a least one; the exact seating tests move from Lato, which now grows, to Ubuntu, which stays exact.
DemchaAV
marked this pull request as draft
October 25, 2026 01:08
applyLineHeight's Javadoc gave an exact line as what it always writes, the engine's line being shorter than the font's. A paragraph's or a text cell's line at least as tall as its faces' own is rewritten as a least height afterwards (letTheLinesGrow, letTheCellsLinesGrow): the Javadoc now says so and no longer claims the line is always the shorter.
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 paragraph's line that is at least as tall as its faces' own is written at a least height (
w:lineRule="atLeast"), which Word grows when a reader makes the text larger. A table's text cell was not:writeCellContentwrote its lines exact, and the row's margins, its lines' heights or its text's position then moved it onto the page's baseline. An exact line keeps its height, so withNormaltwo points larger Word cut the top off the letters of every such cell. In the corpus that is 125 paragraphs of text cells in two invoices and two proposals, and 13 inCobaltRota, its staff names among them.Word and LibreOffice 24.2 stand a least line's baseline its runs' descent above its foot, in top, middle and bottom aligned cells as in the body (measured to 0.15pt). That is where the page sets a cell's line, its height less its face's descent.
What changed
letTheCellsLinesGrowwrites a text cell's paragraphs at a least height where every one of them may grow, by the rule a paragraph's line grows by (DocxGrownLines.mayGrow), and Word then stands the text within a quarter point of the page's. It is called once the cell's paragraphs are written, before its seat is read. All of a cell's paragraphs change or none do.belowThePagereads Word's seat throughDocxGrownLines.lineOf: four fifths of an exact line down, a least line's runs' descent above its foot. A least cell therefore calls for no more than its rounding. In a row of least cellsmoveTheRowsTextleaves the margins as the padding, and it trades no least line for the space after it.Line heightrow and table section, the capability matrix's table row, and the CHANGELOG. The older line-height entry no longer lists text cells among what stays exact.Verification
DocxGrownLinesExportTest(+5):line heightnote;DocxCellSeatTest: the seven tests of the exact seat that used Lato, which now grows, use Ubuntu, which Word sets a quarter point high and which stays exact. The six whose Ubuntu cell holds text state that it is exact.PlatformInvoice's rows held no move.CobaltRota's lines no longer trade height for the space after them.line heightcounts.restyle-body-through-normal, on the five documents: squeezed paragraphs 181 → 84, and three of the five pass, from none. Corpus-wide this is 1041 of 1832, from 1138, with 13 documents passing, from 10.scripts/docx-visual/word-fidelity.ps1): BUILD SUCCESS.NorthlineProposal's phase cells sit in rows with composed cells, whose margins do not move. As exact lines they stood 0.24pt above the cells beside them, 0.05–0.16pt above the page. Least, they moved down those 0.24pt in Word and 0.30pt in LibreOffice and stand level with the cells beside them, 0.08–0.19pt low, as the whole row stands.CobaltRota's names, which their traded lines left 0.08pt high by the export's reckoning, stand 0.12pt lower in Word, one step of its line grid, and 0.10pt in LibreOffice../mvnw -B -ntp clean verify -pl <core, render-pdf, render-docx, render-pptx, templates, testing, qa, coverage> -am→ BUILD SUCCESS: core 823, render-pdf 339, render-docx 2172, testing 5, render-pptx 142, templates 127, qa 1830../mvnw -f examples/pom.xml test→ BUILD SUCCESS, 93 tests.Lane: shared-engine (render-docx). No public API change. Text cells' line rules and their rows' margins change in the file.