Repository navigation
fix(docx): write a row's fill, outline and side borders, as a panel holding its columns - #871
Merged
Merged
Conversation
…olding its columns A row paints its box as a container does, and the export wrote its columns as a table with no shading or borders, naming the paint as lost. A row that paints, stands tall enough and has a place of its own is written through the panel writer containers use (writePanelPiece, which now takes what its cell holds): one cell carrying the fill and borders, its margins the row's padding, and the columns nested in it, laid out without that padding (withoutTheRowsPadding). Its corners are named where they round; a translucent paint is flattened and named, as a panel's. colourUnder counts the row's fill, which Word now shows under what sits on it. A row composed in a table cell or in a page zone keeps its note.
…hat the page sets A row is kept from its panel, its columns written alone and its paint named with the reason, where the panel's margins cannot hold what the page sets: - a padding below zero, or a first or last column whose margin hangs into it; - a band of overlapping layers, a pending resume, or a block under it that closes what a band or a stack's column measures from, where the space round the row is measured to its text. The decision is taken once, before anything of the row is written. The columns in a row's own panel are laid out without its padding on the layout's placed columns and on the row's own arithmetic alike, and are not held to a height of their own. A row the layout moves to a new page keeps the space above it there. Borders above and below are named, Word drawing them outside the panel's row. colourUnder keeps leaving a row's own fill out: what stands on it is written in the panel and reads its shading; what is laid over the row from outside it is written before or after the panel.
…ame its columns under the top border A painted row whose margin is below zero above or below it, or at a side in a cell, is written as its columns alone and its paint named: its columns' table nets the margin against its padding, where a panel owes the space round it on its own and Word starts a table no further left than its cell's text. In the body a row bleeding past the margin stays its panel. A top border wider than the row's padding stands its columns that much lower in Word, where the space above does not take it; the row's note now says so beside its borders above and below. Whether a row is its panel is read once: what keeps it from its panel, then whether it paints a panel of its own. The new-page step a row's panel and a table share is one helper (leaveThePageAbove).
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 paints its box as a container does —
RowBuilder.fillColor,stroke,borders,cornerRadius(RowDefinitionemits the same decoration asContainerDefinition). The DOCX export wrote the row's columns as a table with no shading or borders and named the paint as lost (row paint,DROPPED). Word holds a box's fill and borders on a table cell, as the export already does for a painted container.What changed
A row in the flow that paints its box is written as a panel holding its columns (
writePaintedRow). It goes through the panel writer containers use (writePanelPiece):writePanelPiecetakes what its cell holds (CellContent): a container's children as before, or a row's columns. It also takes whether the layout moves the panel to a new page, and then holds the space the page keeps above it on that page (holdTheSpaceAboveOnItsPage). Before that,writePaintedRowleaves on the page above what the row's table left there (leaveThePageAbove, now shared withwriteTableWithItsOwnSpacing). Containers passfalseand are written as before.The columns in the row's own panel are laid out without the padding (
writeRow(…, inItsPanel),applyRowGeometry,withoutTheRowsPadding). The padding comes off the first and last columns, on the layout's placed columns and on the row's own arithmetic alike, each keeping a child's margin and the gap. The columns are not held to a height of their own: the panel holds the row's.Whether a row is its panel is decided once, before anything of it is written. It paints, stands tall enough to be painted, and has a place of its own in the layout or no layout at all (
paintsAPanelOfItsOwn). It also needs nothing to keep it from its panel (keptFromItsPanel):closesAMeasure). There the space round the row is measured to its text, and the panel's margins would hold the padding again.A row kept from its panel is written as its columns alone; one composed in a table cell is too, and one in a page zone's line is runs on that line.
reportUnwrittenRowPaintnames each's paint with the reason (row paint) —APPROXIMATEDwhere a cell's table drew it as a shape. The note's last arm always names something.What Word draws differently is named on the row's note (
RowNode,APPROXIMATED):paintOfreads a row's paint as a container's: per-side borders win, a uniform stroke stands in for all four.warnContainerRadiusDroppednames a row's squared corners (corner radius). A translucent fill or border is flattened against what the page paints under it and named, as a panel's is. What stands on the row — a chip, a rule — is flattened against the panel's shading as written (surfaceBehind).DocxLayoutMetrics.colourUnderstill leaves a row's own fill out. What stands on the fill is written in the row's panel and reads its shading. What the page lays over the row from outside it is written before or after the panel, where the fill is not under it in Word.Verification
./mvnw -B -ntp install -pl :graph-compose-render-docx→ BUILD SUCCESS, 1239 tests, 0 failures, 1 skipped.DocxRowPaintTest(14):DocxReportedLossesTest: a row in the flow not named; a row composed in a table cell and one in a page zone still named.DocxTranslucencyTest: a chip and a rule in a navy row are flattened against the navy.2.5-dev. Report notes: 954, unchanged.Known limits
Lane: render-docx (DOCX semantic backend) — no public API change.