Repository navigation
fix(docx): name a table whose columns are left to the editor - #915
Merged
Merged
Conversation
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
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.
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
The DOCX export writes a table's columns from the layout — the widths
DocxLayoutMetrics.tableColumnsreads 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:
under that table's path, and the export cannot tell them apart (
DocxComposedCellTestpins thewidth it is given: the column it sits in);
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 whereapplyTableWidthleaves the split to theeditor): an
APPROXIMATEDnote, subjectTableNodeas the row's equivalent note usesRowNode, naming the case — "composed in a table cell, it is laid out among its table's ownrows, which do not tell its columns apart" (
composedInACell) or "the layout's rows of it donot 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 thedeclared columns (
TableGrid.columnCount).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.
DocxWithoutLayoutadds "a table's fixed column beside an auto one is writtenwith no width either" to the section's note where the section holds one; the base sentence is
unchanged otherwise.
DocxNodeFieldLedgerTest:TableNode.columnsisREPORTEDwith those cases.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 (
gridCol2400and 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 besidean auto one, in a cell and beside an undeclared position; not for all fixed or all auto).
guard, the two reasons, the fixed clause, each half of
fixedBesideAuto, the undeclaredposition, the no-layout clause and its walk — all caught.
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--checkpasses.Lane: render-docx (semantic backend) — report notes; no output change.