Skip to content

fix(docx): name a panel's left edge its table cell holds in - #943

Merged
DemchaAV merged 2 commits into
2.5-devfrom
fix/docx-hung-bars
Oct 22, 2026
Merged

DemchaAV merged 2 commits into
2.5-devfrom
fix/docx-hung-bars

Conversation

@DemchaAV

@DemchaAV DemchaAV commented Oct 22, 2026 •

Copy link
Copy Markdown
Owner

Why

The page sets a panel in a table cell with its left border centred on the cell's text edge, half of it outside, or further out by a margin below zero. Its nested table is written that far left of the cell's text (w:tblInd below zero), but the editors do not always set it there.

Measured on Windows with 3pt accents:

  • LibreOffice starts a nested table at its cell's text: 1.5pt right of the page's, and a box's in a ruled table cell 1pt.

  • Word does the same in a row's cell and in a table cell, filled or not: 1.55 to 1.73pt right.

  • Word in a filled panel's cell, or a row inside a filled panel, sets the table where it is written: 0.04 to 0.17pt off.

    Patching the XML of one case at a time isolated the panel cell's shading as what turns this on. The table indent, fixed layout, cell borders, row height and keep-together made no difference.

  • In the corpus, Engineering Resume's 2pt and 3pt card accents stood 1.05 and 1.71pt right in Word, and the 3pt accents of Classic and Modern invoices' two-column blocks 1.58 to 1.63pt. The report said nothing.

Separately, a panel that a placed row holds as a column had its left margin counted twice in its table's indent. The row's cell already starts past that margin, so the panel stood its margin further right.

What changed

  • left edge note (writePanelPiece, leftEdgeHungOut):
    • A panel in a table cell that the page sets a tenth of a point or more left of the cell's text is named: how far, up to which the editors move it.
    • The note says LibreOffice starts a nested table at its cell's text, and that Word may. Which cells Word honours the indent in is stated in the recipe, as measured. The note does not claim it for cells that were not measured.
    • A margin below zero moves the whole table, its text too, so every such panel is named, whatever it paints. Its note names the panel and its text rather than its left edge.
  • The row column's margin counted once: edge leaves out the child's left margin where the placed row's cell already starts past it (leftMarginInCell), as the paragraph, list and table writers already do. No panel of the corpus has such a margin, so no file changes.
  • Comments: where a comment said Word always keeps a nested table in its cell — the hang give-up (whatTheHangGivesUp), the row's hang, the cell hang, the tblInd writes — it now names the filled panel's cell as the exception. The give-up's @param padding is documented.
  • Ledgers: the fill and stroke of sections, containers, painted rows and shape containers, and the borders of the first three; the margins of sections, containers and shape containers; a shape container's padding; DocumentBorders' four sides; and DocumentStroke.width name the left edge (LEFT_EDGE), as does DocumentInsets.left.
  • Docs: the recipe's nesting passage, the capability matrix's rectangle-shape row, and the CHANGELOG (Public API).

Verification

  • DocxPanelLeftEdgeTest (new, 11 tests):
    • a 3pt accent in a row's cell, in a row inside a filled panel, and alone with no fill, each named 1.5pt;
    • a painted row with a 3pt left border inside a filled section, named 1.5pt;
    • a row's column whose card has a 6pt margin, its cell already past it, named 1.5pt and written at w:tblInd −30 twips;
    • a card with a margin below zero in a bordered panel's cell, painting only a right border, named 4pt as the panel and its text;
    • a box composed in a table cell with a 1.1pt border, named 0.55pt;
    • not named: a card 2pt in from its panel's cell, a 0.15pt hairline, an accent in the body, and a card bled left in the body.
  • Fail-closed: seven sabotages, each run alone, all caught:
    • the note never written;
    • any hang named;
    • named in the body too;
    • half the border named instead of the indent;
    • a row's child's margin counted twice;
    • a bled panel named for its left edge;
    • every panel at its cell's edge named as bled.
  • Corpus: 0 of 62 DOCX change. Notes go from 1284 to 1359: 75 left edge, none of the others changed.
  • ./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 -am
    → BUILD SUCCESS (render-docx 2050 tests, qa 1828). The JDK 17 checks pass: the knowledge pack, @Beta stability doc, claims and routes, and core javadoc with 0 warnings.

Lane: shared DOCX backend (render-docx). No public API change.

The page sets a panel in a table cell with its left border centred on
the cell's text edge, half of it outside, or further out by a margin
below zero, and its nested table is written that far left of the text.
LibreOffice starts a nested table at its cell's text, and so does Word
in a row's or a table's cell, though not in a filled panel's: the panel
stood up to that much right of the page's, and nothing said so. The
report now names it (left edge).

A panel a placed row holds as a column had its left margin, which the
row's cell already starts past, counted again in its table's indent; it
is counted once.
@DemchaAV
DemchaAV marked this pull request as draft October 22, 2026 18:33
- A panel that a margin below zero sets left of its table cell's text is
  named as the panel, its text with it, rather than by its left edge.
- Comments that said Word always keeps a nested table in its cell name a
  filled panel's cell as the exception.
- Word's measured offset in a filled panel's cell is 0.04 to 0.17pt.
- A right border and a stroke's width name the left edge in the value
  ledger, and the ledgers say "Word in most cells", as the docs do.
- Tests: a painted row with a 3pt left border in a filled section is
  named; a row column's card with a 6pt margin is written at
  w:tblInd -30.
@DemchaAV
DemchaAV marked this pull request as ready for review October 22, 2026 18:50
@DemchaAV
DemchaAV merged commit bf0a7de into 2.5-dev Oct 22, 2026
13 checks passed
@DemchaAV
DemchaAV deleted the fix/docx-hung-bars branch October 22, 2026 19:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant