feat(msword): parse native Word charts as classified pictures with data#3809
Open
DanielNg0729 wants to merge 1 commit into
Open
feat(msword): parse native Word charts as classified pictures with data#3809DanielNg0729 wants to merge 1 commit into
DanielNg0729 wants to merge 1 commit into
Conversation
Detect charts embedded in .docx (a w:drawing graphic frame referencing word/charts/chartN.xml) and emit them as classified PictureItems whose meta carries the chart-type classification and the chart data reconstructed from the inline numCache/strCache — no LibreOffice required. Add MsWordBackendOptions.render_chart_images (default False) to optionally attach a LibreOffice-rendered image; charts always keep their classification and tabular data regardless. Non-chart DrawingML (shapes, SmartArt) is unchanged. Note: charts are no longer rendered as a generic image by default; the image is now opt-in, matching the Excel/PPTX chart behavior. Signed-off-by: Daniel Nguyen <danielnguyenh07@gmail.com>
Contributor
|
✅ DCO Check Passed Thanks @DanielNg0729, all your commits are properly signed off. 🎉 |
Contributor
Merge Protections🔴 1 of 2 protections blocking · waiting on 👀 reviews
🔴 Require two reviewer for test updatesWaiting for
This rule is failing.When test data is updated, we require two reviewers
Show 1 satisfied protection🟢 Enforce conventional commitMake sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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.
Hi maintainers, This PR follow up with #3777 and #3794 which adds Word parity for the native-chart handling already shipped for Excel and PowerPoint. Charts embedded in
.docxfiles (aw:drawinggraphic frame referencingword/charts/chartN.xml) are now parsed into classifiedPictureItems that carry the chart's underlying data reconstructed as a table.What changed
PictureItemwhosemetacarries:bar_chart,line_chart,pie_chart,scatter_chart,other_chart) derived from the plot element underc:plotArea;TabularChartMetaField, read directly from the inlinec:numCache/c:strCache— no LibreOffice required, fully deterministic.MsWordBackendOptions.render_chart_images(defaultFalse). When enabled (and LibreOffice is available), a rendered image is attached to the chart picture via the existing DOCX→PDF→PNG path; charts keep their classification and data regardless.Behavior change
Previously a chart was rendered as a generic, unclassified image by default whenever LibreOffice was present (and produced nothing without it). It is now a classified picture with tabular data by default, and the rendered image is opt-in via
render_chart_images=True. This matches the Excel/PPTX chart behavior. The rendered image is LibreOffice's rendering, not a pixel copy of Word's styling.Tests & reference data
drawingml.docxfixture (a line chart with 3 series).drawingml.docxgroundtruth: the chart picture now carries its classification + data table (and no default image); other pictures unchanged.Checklist: