fix(docx): keep a card's paint off the paragraphs in its table's cells - #731
Merged
Merged
Conversation
A composed table cell writes its paragraphs through the body path, so they took the enclosing card's fill and border as paragraph shading: in a zebra table inside a filled card the composed cell showed the card's colour over its stripe, and a bordered card boxed the paragraphs inside cells. A paragraph in a cell now takes paint only from a container opened inside that cell.
writeRow shaded its cells with the innermost panel's fill without the cell check, so a row built into a zebra cell of a filled card came out in the card's colour over the stripe. Row cells and cell paragraphs now ask the same question (paintHere). Tests pin a row in a composed cell, a row directly in a bordered card, and the panel painting again after a table.
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 filled or bordered card is written by painting every paragraph inside it (
w:shd,w:pBdr), since Word has no element that wraps a run of paragraphs.A table inside the card writes its plain-text cells directly. A cell built from a node (
DocumentTableCell.node(...)) goes throughnewBodyParagraph, the same path as body paragraphs, and that path painted it with the card too. In a zebra table inside a filled card, the composed cell came out in the card's colour laid over its stripe. With a bordered card, the paragraph inside the cell got boxed.What changed
newBodyParagraphtakes container paint only from containers opened inside the cell being written.writeCellNoderecords how many containers were open when the cell began (cellPaintDepth, saved and restored around nested cells).w:shdon the cell) shows as the page draws it.writeRowasks the same question throughpaintHere(), which both paths share. Before, a row built into a zebra cell of a filled card shaded its own cells in the card's colour, covering the stripe. A row placed directly in a card still shades its cells with the card's fill. It no longer draws a bordered card's outline around the text of each cell, which matches the PDF: the PDF draws only the card's outline.TableCellLayoutStyle.DEFAULT), so the PDF draws such a cell white inside a card too. In Word the card's shading sits on its paragraphs and never under the table, so that cell is already white. Shading it with the card's colour would have moved Word away from the PDF.Verification
In an editor. A card with a zebra table whose last row holds a composed cell, converted with LibreOffice. The composed cell is grey like the rest of its stripe, as in the engine's PNG. Before the change its paragraph shading was the card's
E6F0FF.Gate. Full reactor gate (
clean verifyover core, render-pdf/docx/pptx, templates, testing, qa, coverage) → BUILD SUCCESS. Examples after install: 93 green. No committed preview moved.New tests in
DocxContainerPaintTest(12 total, +5):Reverting either path to "always paint" fails the matching test.
Found alongside, not fixed here. Two tables with nothing between them are merged into one table by LibreOffice. Their different column grids then squeeze the result, and text breaks letter by letter. I proved this by swapping tables in the XML. It affects any two consecutive tables, not only inside a card, and is the next PR.
Lane: shared-engine (render-docx). No public API change.