Skip to content

fix(docx): name a table whose columns are left to the editor - #915

Merged
DemchaAV merged 2 commits into
2.5-devfrom
fix/docx-unmeasured-table-columns
Oct 18, 2026
Merged

DemchaAV merged 2 commits into
2.5-devfrom
fix/docx-unmeasured-table-columns

Conversation

@DemchaAV

@DemchaAV DemchaAV commented Oct 18, 2026 •

Copy link
Copy Markdown
Owner

Why

The DOCX export writes a table's columns from the layout — the widths DocxLayoutMetrics.tableColumns
reads off the table's own rows — or, where every column is fixed, from the document. A table with
an auto column that the layout does not show the widths of falls between the two, and was written
with its columns left to Word, with nothing in the report:

  • composed in another table's cell — the layout lays its rows out among the owner table's,
    under that table's path, and the export cannot tell them apart (DocxComposedCellTest pins the
    width it is given: the column it sits in);
  • with a column edge no row of it shows — the grid read off the rows is a column short.

Where such a table has a fixed column, its width is not written either: a grid is every column's
width or none. A position past the columns a table declares is sized as an auto one, so a fixed
column beside it is lost the same way.

Measured in Word and LibreOffice on Windows (the export's PDF against both editors' PDFs, word by
word): a table of two auto columns composed in a cell came out half the cell's 242pt a column in
both, its first column 121pt where the page sets it 45; with a fixed column of 120pt beside an auto
one, the fixed column came out 146pt wide in both. A table of three auto columns whose two rows both
span the first two Word set as the page did, and LibreOffice set its last column 83pt further
right. A nested table of fixed columns stood where the page puts it in both.

What changed

  • nameTheColumnsLeftToTheEditor (called where applyTableWidth leaves the split to the
    editor): an APPROXIMATED note, subject TableNode as the row's equivalent note uses
    RowNode, naming the case — "composed in a table cell, it is laid out among its table's own
    rows, which do not tell its columns apart" (composedInACell) or "the layout's rows of it do
    not show every one of its column edges" — and, where the table has one, "its fixed columns'
    widths are not written either".
  • fixedBesideAuto: a fixed column beside a non-fixed one, or beside a position past the
    declared columns (TableGrid.columnCount).
  • A chart's data table is not named (writingAChartsTable, saved and restored round its write):
    the page does not draw it, and the chart's own note says what is written for it.
  • No layout: DocxWithoutLayout adds "a table's fixed column beside an auto one is written
    with no width either" to the section's note where the section holds one; the base sentence is
    unchanged otherwise.
  • DocxNodeFieldLedgerTest: TableNode.columns is REPORTED with those cases.
  • Docs: the recipe (composed cells, table columns, the no-layout fallback), the capability matrix's
    table row, withAGrid's Javadoc, CHANGELOG v2.5.0.

Verification

  • ./mvnw -B -ntp test -f render-docx/pom.xml — DocxTableColumnsLeftToTheEditorTest (new, 9;
    each with-layout case asserts the layout stood behind the export): a composed table of auto columns named, its
    path null; a fixed column beside an auto one and beside a position past the declared columns
    named with the fixed clause; a composed table of fixed columns written at them (gridCol 2400
    and 2200) and not named; a flow table with an edge no row shows named, with its fixed columns
    too; measured tables, rows showing the edges between them included, not named; a chart's data
    table in the flow and in a cell not named, and a table after a chart still named; no layout, no
    table note but the section's. DocxWithoutLayoutTest +1 (the clause for a fixed column beside
    an auto one, in a cell and beside an undeclared position; not for all fixed or all auto).
  • 11 sabotages, each undoing one part — the note, the chart flag and its restore, the no-layout
    guard, the two reasons, the fixed clause, each half of fixedBesideAuto, the undeclared
    position, the no-layout clause and its walk — all caught.
  • Corpus: 62/62 DOCX byte-identical; report notes 1246 → 1246 (no corpus table is composed with
    an auto column or hides an edge).
  • ./mvnw -B -ntp clean verify — BUILD SUCCESS (core 821, render-docx 1746, examples 93, qa 1820); the knowledge pack's
    --check passes.

Lane: render-docx (semantic backend) — report notes; no output change.

A table with an auto column whose widths the layout does not show was
written with its columns left to Word, and the report said nothing:
one composed in another table's cell, which the layout lays out among
that table's own rows, and one with a column edge no row of it shows,
which leaves the grid read off the rows short of a column. Measured in
Word and LibreOffice on Windows, a two-column table in a cell came out
half the cell a column in both, its first column 121pt where the page
sets it 45, and a fixed column of 120pt beside an auto one 146pt: a
grid is every column's width or none, so the fixed one is not written
either, and the same holds beside a position past the columns a table
declares, which the layout sizes as an auto one.

The report names such a table (TableNode), saying which of the two it
is and, where it has one, that its fixed columns are not written. A
chart's data table, which the page does not draw, is not named. With no
layout behind the export, the section's note now says that a fixed
column beside an auto one is written with no width.
@DemchaAV
DemchaAV marked this pull request as draft October 18, 2026 16:01
The case for a table of fixed columns composed in a cell declared a
list of notes it never read. The Javadoc of the table's note, of
withAGrid and of the no-layout note is wrapped at the file's width
again.
@DemchaAV
DemchaAV marked this pull request as ready for review October 18, 2026 16:07
@DemchaAV
DemchaAV merged commit 317b257 into 2.5-dev Oct 18, 2026
13 checks passed
@DemchaAV
DemchaAV deleted the fix/docx-unmeasured-table-columns branch October 18, 2026 17:09
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.

2 participants