Repository navigation
fix(docx): name in the report what the export draws as a picture or draws without - #900
Merged
Merged
Conversation
…raws without An inline shape and an SVG icon with no text are reported as pictures, once for a page zone's line. Corners of different radii drawn at the largest are named wherever a box is drawn. A path's note names only what it loses, against the measured editor defaults: no cap ends flat, no join is round. A path painted only with a gradient is dropped for that, and the page-number note no longer says Word's fields cannot be offset.
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
A DOCX export's report is meant to name everything the export does not write as authored. Some of what it draws was not named at all, and some notes said more than was lost:
DocxShapePicturessaid Word cannot hold a drawing in a line. It can (wp:inlineround awps:wsp); the export simply does not write one.ShapeNode's unequal corners were already named.<a:ln>with nocapand no join. Measured with a 10pt stroke, Word and LibreOffice then draw flat ends, as the page's butt default does, and round joins, where the page mitres: the point of a V stood 2.76pt short in both. So a round join is carried, and the page's default mitre is not.w:pgNumTypecould start them elsewhere; the export does not write one.What changed
writeInlinePicture/reportInlinePicture. EachInlineShapeRunis reported as aninline shape, and eachInlineSvgRunwithout text as aninline icon, bothAPPROXIMATED. An icon with text keeps its note, which names the text as the picture's description.zoneLinesReported, aszonePartsReportedalready does for shapes.warnDroppedInlineRunsfollows the same rule.Corners.
drawOwnFragmentsreads the radii off what it drew.roundsCornersUnequallyasks for aShapeFragmentPayloadwith non-uniform radii whose box is drawn (DocxDrawings.drawsItsBox), so a box drawn as its side borders alone has no corners to name.ShapeNode's corners stay with the rest of what it is drawn without.cornersDifferindrawOutlineOf. That applies only when its table draws it and its fill or stroke shows.pathStyleLost, replacinglosesStyle, names only what the path loses:hasOpenEnds);joinsSegments).carriedWithoutgains aPathNodebranch, so a path composed in a table cell names its caps and joins. The table's note names the gradient and the dash, as it does for every drawing in its cells.Other notes:
droppedBecause: a path painted only with a gradient is dropped for that, as aShapeNodealready was.bandPageClasses: the page-number note says the export writes the fields without the offset.Javadoc and ledger. The
DocxShapePictures,InlineSvgRastersandDocxInlineShapeTestJavadoc no longer say Word has no drawing in a line.DocxNodeFieldLedgerTestrecordsShapeContainerNode.outlineand.layersas reported, and a line's butt cap as ending flat.Docs.
docs/recipes/docx-export.mdand the capability matrix state the measured defaults, what each note names, and that the page-number offset is not written rather than impossible.Verification
./mvnw -B -ntp clean verify→ BUILD SUCCESS:render-docx1573 tests,qa1820.render-docx: +11 tests. Two were renamed, and their assertions changed with the behaviour.Inline pictures.
anSvgIconAndAShapeInTheLineAreNamedPicturesInTheReportchecks both notes word for word, with their severity.anAuthorsPictureInTheLineIsNotNamedAnIconchecks that an author's own picture gets neither.A page zone.
aShapeAndAnIconAmongAPageZonesWordsAreReportedOnceThoughWrittenIntoTwoFooterschecks the zone is in two footers, with one note each.Corners that differ:
aDrawnContainerWithCornersOfDifferentRadiiSaysTheyAreDrawnAtTheLargest;aSectionDrawnOverTheFlowWithCornersOfDifferentRadiiSaysTheyAreDrawnAtTheLargest;aTileComposedInATableCellSaysItsCornersAreDrawnAtTheLargest.No corners note:
aContainerWithEqualCornersSaysNothingOfThem;aSectionDrawnOverTheFlowAsItsBorderAloneHasNoCornersToName;anUnpaintedTileComposedInATableCellSaysNothingOfItsCorners.A
ShapeNode's corners are named once.Paths.
aDrawnPathNamesOnlyWhatItLosescovers:aPathComposedInATableCellNamesTheCapsAndJoinsItsTableDoesNotcovers a cell path.Other notes.
aBuiltInPathNothingShowsIsDroppedForItsGradientpins the reason.numberingTheExportWritesWithoutItsOffsetIsReportedpins the page-number note, and that now:pgNumTypeis written.Sabotage. Each of 20 parts undone fails at least one of these tests: every note, every guard (paint, stroke, open end, joined segments, drawn box, zone line), the shape's corners named twice, and both old wordings.
Corpus. All 62 corpus documents were exported against
2.5-dev, and nodocument.xmlchanges. Their reports go from 969 notes to 1340:No other note changes.
Measurement. A probe document held a 10pt butt line, a mitred V and a butt line node, and the same three set square and round. It was exported, converted with Word 16 and LibreOffice on Windows, and the ink measured per colour at 8 px a point. With no
capand no join written, both editors drew each end where the page's butt end stands, and every join round.Lane: shared-engine (
render-docxexport report). No DOCX bytes change.