Repository navigation
fix(docx): cut a rule row's empty line to the room its row leaves it - #812
Merged
Merged
Conversation
…margins, and leave a paragraph's border alone The row is written less the most any cell takes above and below its content, and Word reads it as the row's whole; the room is that height with the left-out part added back and the cell's own margins and border taken off. Taken off the written height alone, a padded blank row's line lost its padding twice. A paragraph with a border or shading of its own draws on its line and is not cut.
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,
CobaltRota's sheet stood 2.48pt below the page at the median, with 119 of its 154 lines more than 2pt off. LibreOffice was the same: 2.39pt, 124 lines.Its header opens and closes with a row that is only a rule. Each is an empty cell whose font sets the rule's thickness: a 2.3pt and a 1.95pt line under a 0.9pt border. On the page the rule's borders are drawn across that line. Word and LibreOffice keep a cell's borders outside its content. The row is written less its border (
holdRowAtLeast), but the line inside it was not, so each editor grew the row to the line plus its borders. Measured in Word, the first rule stood 4.08pt where the page has 3.2. The two rules put the whole sheet under them about 1.8pt low.What changed
fitBlankLinesToTheRow, afterholdRowAtLeastinholdRowHeight. A cell that holds a single paragraph with no letters has its exact line cut to the room its row leaves it. The floor is a 2-twip hairline.holdRowAtLeastwrites the row less the most any cell takes, and Word reads that as the row's whole height. The room adds that back and takes off only what this cell takes. For the rule rows, whose cells take only the border, it is the written height.holdsNoLetters). A rulewriteRuledraws as a paragraph's border keeps its line.word-windowsandlibreoffice-windowsare rewritten forCobaltRota, the one document this moves.CHANGELOG.md, and the Tables row ofdocs/recipes/docx-export.md.Verification
Template corpus, line by line against
2.5-dev's baselines. Both gates pass. No other document changes in either editor.CobaltRotaCobaltRotaThe cause, measured before the code. The rule rows' lines were cut by hand in the exported DOCX (46 → 28 and 39 → 21 twips, and separately to 2) and converted in Word. Both gave a median of 0.74pt and no line past 2pt.
Hidden closing paragraph ruled out. Word already gives the hidden paragraph that closes a cell after a nested table no height. Changing it moved nothing.
New tests,
DocxRuleRowTest:Each rule fails its own test when taken out.
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 781 tests, qa 1813.Known limits
cutTheLabelToItsOutline). That residue is what is left of the 0.74pt median.MANAGEMENT,BARTENDERS,BARBACKS). The gate measures lines vertically and does not see it.Lane: shared-engine (render-docx). No public API change.