Repository navigation
fix(docx): name in the report what each written or drawn node goes without - #856
Merged
Merged
Conversation
…thout The export wrote or drew these nodes and said nothing of what it left behind: a linked logo became an unlinked picture, a rotated photo stood upright, a dashed line was drawn solid, an anchor on a drawn shape left a page reference or a link to it pointing at no bookmark. carriedWithout names, per node, a link, an outline entry, a drawn shape's anchor, gradient fill and unequal corners, a line's dash and caps, and an image's transform. Drawn shapes, pictures beside their text and barcodes add these to the note they had; a rule, a picture in the flow, a table, a section or container - the page flow, a panel, a layer stack's column, one laid over the flow - gets a note of its own; a drawing composed in a table cell names what no drawing carries, leaving its paint to the table's note. A shape painted only with a gradient is dropped for that reason. A drawn line's caps are said to be left to the editor, as its outline is written without one. The ledger moves 21 node fields from a gap to REPORTED, and records a section's anchor as a gap where the section is a layer stack's column: its bookmark is not written, though a page reference to it is a PAGEREF. The DOCX bytes do not change.
| com.demcha.compose.document.node.DocumentLinkTarget link = null; | ||
| com.demcha.compose.document.node.DocumentBookmarkOptions outline = null; | ||
| String anchor = null; | ||
| if (node instanceof com.demcha.compose.document.node.ShapeNode shape) { |
…ps in the report A section or container written as a layer stack's column gets no bookmark, while a link or a page reference to its anchor still names one; its note now says so, and the ledger moves both anchors from written to reported. A drawing composed in a table cell names its unequal corners and caps, which the table's note does not; only the gradient and the dash are left to it. A gradient-only shape in a cell is no longer taken for drawn by its table, and is dropped for its gradient. A painted section laid over the flow names its outline entry once. A drawn anchor's page reference is said to be a fixed number, which is what is written.
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 wrote or drew these nodes and said nothing about what it left behind, while
DocxExportReportpromises to say it:PAGEREFto its anchor still named one.DocxNodeFieldLedgerTest(#855) listed most of these as gaps, and the column anchor as written.What changed
carriedWithout(node, drawn[, paint])names what a node goes without:cap, so the note says the editor ends it its own way rather than claiming a particular result. A rule's caps are lost because a border ends flat;drawOwnFragments), pictures beside their text or over a badge (drawWhereThePagePutsIt) and barcodes add these losses to the note they already had.drawOwnFragmentsadds them for drawings only: a painted section's own losses are named where the section is written, so they are not named twice.reportWrittenWithout, whichever path writes them:writeLayerColumns, which never dispatches the layer itself). This note also names the column's anchor, since no bookmark goes round a column;rule linksubject, so it is not named twice. A table with no rows, which writes nothing, gets no note.drawnByItsTable) names its link, outline entry, anchor, unequal corners and caps. The table'scell drawingnote already names a gradient, a dash, a clip or a transform for every drawing its cells hold, sopaint=falseleaves out only the gradient and the dash.paintedOnlyWithAGradientnow holds it back there, asdrawsAFlatColouralready did for a path.REPORTED.WRITTENfields move toREPORTED: a section's and a container'sanchor, which as a layer stack's column get no bookmark.Not changed: a link or a
PAGEREFto a column's anchor still names a bookmark the file does not hold. Bookmarking the column changes what is written, so it is left to a change of its own. Here it is reported.Verification
./mvnw -B -ntp install -pl :graph-compose-render-docx→ BUILD SUCCESS: 990 tests, 0 failures, 1 skipped (the property-gated fidelity probe).DocxCarriedWithoutReportTestis new, 18 tests. Each test of a node the export writes or draws checks which path wrote it through the start of its note, such aswritten as a paragraph border,drawn as a shape,composed in a table cellorwritten over the flow as what it holds:drawOwnFragments, and the gradient guard indrawnByItsTable.DocxFidelityCorpusTest -Dgraphcompose.docxFidelity=export, SHA-256 per file, 0 of 62 differ.-pl :graph-compose-core -Dtest='com.demcha.documentation.**'→ 166 tests, 0 failures;DocxPageZoneTest,DocxTransparentWrapperTest,TimelineRailAcrossBackendsTestandRtlAcrossBackendsTest→ 52 tests, 0 failures.Lane: render-docx backend (report only, no change to what is written) plus tests and docs.