Repository navigation
fix(docx): write a chart in a table cell as its data table, and draw nothing of it over that table - #916
Merged
Conversation
…nothing of it over that table
A chart composed in a table cell was written as its data table, as a
chart is anywhere, and drawn as well: its fragments are among the
table's own, which the cell drawings draw. Measured in Word and
LibreOffice on Windows, its bars and grid lines stood over the data
table and hid its numbers ("Sales" read "Sa", 2.5 read "2."), without
its axis labels, while the report said it was exported as its data
table.
Where the chart is all its cell draws, alone or with text, lists,
spacers and wrappers that paint nothing beside it, every drawing the
layout places in the cell's box is the chart's, and none is drawn: the
chart is its data table there too. A chart beside other drawings in its
cell, whose drawings the export cannot tell from its own, or in a table
composed in a cell, whose cells the layout gives no box, is still
drawn, and its note now says so.
The export's log line, the chart's Javadoc, the charts recipe and the
Word export example said the export has no layout pass, or draws no
vector geometry; what it does not write is a Word chart. The example's
committed DOCX and PDF are re-rendered for its caption.
DemchaAV
marked this pull request as draft
October 18, 2026 18:58
…w nothing beside one The set of charts not drawn holds the charts that are all their cell draws, which its comment now says, with what keying it by identity does to a chart node placed twice. The kinds that draw nothing beside a chart are named as the set holds them.
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 every chart as its data table (
writeChartFallback). A chart composed in atable cell was drawn as well: a composed cell's content has no layout path of its own, its
fragments are among the table's, and
drawCellDrawingdraws the table's drawings — the chart'sbars and grid lines included. Measured in Word and LibreOffice on Windows, they stood in front of
the data table and hid its numbers ("Sales" read "Sa", 2.5 read "2."), and the chart's axis labels,
the page's text, were not drawn at all. The report said only "exported as its data table".
The log line said "the semantic DOCX export has no layout pass", and
ChartNode's andChartDefinition's Javadoc, the charts recipe and the Word export example's caption said the sameor that the export "does not draw vector geometry". Neither holds: the export reads the layout and
draws geometry. What it does not write is a Word chart.
What changed
cellsBuiltFromAChart(indrawCellDrawing): the boxes of a table's cells whose drawing isa chart's alone (
chartDrawnAlone— one chart, and beside it only paragraphs, lists, spacers,page breaks, alignments and sections or containers that paint nothing), every box the layout
placed the cell in (a repeated header row has one a page). A table fragment those boxes hold
(
CellBox.holds) is not drawn; one that only reaches into them is. The chart is recorded inchartsNotDrawn, reset per export.beside other drawings, which it cannot tell its own from, or in a table composed in a cell, whose
cells the layout gives no box — adds "its bars, lines and slices are drawn as well, where the page
draws them, over the table and without its text".
writeChartFallback's Javadoc,ChartNodeandChartDefinition(core, Javadoconly),
docs/recipes/charts.md,docs/recipes/docx-export.md, andWordExportExample's captionnow say the export writes no Word chart;
assets/readme/examples/word-export-companion.{docx,pdf}are re-rendered for the caption (
CommittedAssetDriftTestnamed exactly those two).A drawing another cell pushes wholly into a chart's box — by a layer's offset or a margin below
zero — is taken for the chart's; the Javadoc says so.
Verification
clipped data table → the data table alone.
./mvnw -B -ntp test -f render-docx/pom.xml—DocxChartInACellTest(new, 9, each with-layoutcase asserting the layout stood behind it): a chart a cell is built from — its data table there,
no drawing, the plain note, no "cell drawing" note; in an unpainted section, alone and under a
caption, not drawn; beside a disc in its cell, drawn and named; two charts in a cell and a chart
in a painted section, drawn and named; a neighbour's tile in its own cell, and one a margin below
zero widens into the chart's cell, still drawn; a chart in a header row repeated over pages, and
in a cell spanning two columns, drawn on no page; in a table composed in a cell, drawn and named;
in the flow and with no layout, the plain note; one backend over two exports of one chart node.
drawing-alone walk,
holdsforoverlaps, the first box only, the cell's own content only, twocharts taken for one, a painted wrapper taken for nothing — all caught.
./mvnw -B -ntp clean verify— BUILD SUCCESS (core 821, render-docx 1755, examples 93, qa 1820);CommittedAssetDriftTestpasses on the re-rendered example; the knowledge pack's
--checkand claims pass.Lane: render-docx (semantic backend) — cell drawings and a report note; core Javadoc and the
example's caption.