Repository navigation
fix(docx): hold a shape and a middle table row to the rules Word counts - #880
Merged
Merged
Conversation
- A shape container held whole takes its borders off its row's height, and the room it leaves its label, as wide as Word draws them: a border is written in eighths of a point and a row counts it two and a half twips an eighth, rounded down. Taken off at the width the page strokes, a 20.3pt chip outlined at 0.7pt (drawn 0.75pt) stood a twip taller in Word and LibreOffice on Windows, and six of them in a table's rows six twips lower below them. - A table's row between two others is held less the rest of its own rule above it and half the rule of the cell under it, as its margins already give them up. Held less its own rule alone, a row ruled at 0.5pt over one ruled at 1.5pt stood half a point taller in Word. A row is held less the most any one of its cells takes, its margins and those rules together. Rows are held once the whole table is written, since a row's share of the rule under it is the next row's. - A panel's border is written from two to ninety-six eighths of a point, as a table cell's rule is, so a row counts it at the width written. - Docs: the CHANGELOG entry, the recipe's table and shape-border paragraphs, and the capability matrix's table and panel rows. - Tests: DocxComposedCellTest covers a chip held, its label's room and its middle counted less borders drawn wider and narrower than the page strokes them; DocxRuledRowHeightTest covers a middle row ruled unlike the next, both ways round, a table ruled column by column and a cell after a span and a row ruled cell by cell; DocxContainerPaintTest covers a panel's border range.
…BeyondOne It covers every row of a table now, not the outer ones alone.
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
Two row heights were still counted differently from the way Word counts rules.
eighthsInTwipsalready applies to table cells).holdThePanelsHeightandsetOnTheShapesMiddletook the lighter border off at the authored width instead, and the label's room incutTheLabelToItsOutlinetook both; the heavier border already came off throughverticalMargins, at the width written.clearOfTheRules). The height it holds did not:outerRulesBeyondOnereturned 0 for every row but the first and the last.Both were measured on a probe document, page against Word 16, LibreOffice on Windows and LibreOffice 24.2: four outline widths, in a table cell and in the flow, and five-row tables with one row ruled unlike the rest, both ways round.
What changed
In
DocxSemanticBackend:holdThePanelsHeight,cutTheLabelToItsOutlineandsetOnTheShapesMiddleread the borders as written. They read them from the cell (rule(cell, top)), in whole twips, and no longer take the authored stroke. The unusedbordersparameters are removed.outerRulesBeyondOnecovers every row and is renamedrulesBeyondOne. Each cell holds the rest of its own rule above it, or the whole rule in the first row, and half the rule of the cell under it, or its own rule whole in the last row. The row is held less the most any one cell takes, its margins and those rules together: two maxima taken from different cells would hold a row ruled cell by cell short.ruleAt,gridSpan), the one whose ruleclearOfTheRulesalready takes off the padding; a spanning cell's is its first column's. A table ruled column by column, alike row to row, is held as before.paintCellSidewrites a panel's border from 2 to 96 eighths (ruleEighths), as a table cell's rule is, so that a row counts it at the width written. Before, a hairline thinner than 0.19pt was written at one eighth, and a border past 12pt above the range.writeTableRowsholds the rows once the whole table is written. A row's share of the rule under it is the next row's. The first row already waited for the second; every other row now waits too.Docs:
CHANGELOG.md(v2.5.0), the DOCX recipe's table and panel-border paragraphs, and the capability matrix's table and panel rows.Verification
./mvnw -B -ntp clean verify→ BUILD SUCCESS: render-docx 1382 run, 0 failures, 1 skipped (+8), qa 1820, core 818, examples 93.DocxComposedCellTest:DocxRuledRowHeightTest:DocxContainerPaintTest: a panel's 0.1pt border is written at 2 eighths and a 14pt one at 96.Eleven sabotages, each caught by its own test:
Probe, page against the editors, in twips over the whole block:
DOCX fidelity corpus: all 62 documents are byte-identical to
2.5-dev, so the Word and LibreOffice baselines, Linux included, do not move. The change adds or alters no report note.Notes for review
ClassicInvoice's summary table is not a gap. The footer below it stands 0.2–0.33pt low in all three editors, and that is the seat of each line in the footer's column cells: Word sets its 10.15pt label 0.22pt low. In LibreOffice, the flow under the table is within 0.05pt of the page's. Seating lines in such cells is its own change.Lane: shared-engine (DOCX backend) —
render-docx; no public API.