fix(xlsx): overlay same-row worksheet drawings#472
Merged
Conversation
Excel lays shapes anchored to the same row out side by side over the grid. office2pdf reserved a full-width flow box per shape, so each one advanced the flow before the next: three shapes on row 3 formed a diagonal stack at 150 DPI tops of 246, 486, and 726 px against Excel's 188, 188, 188, and the tripled reservation spilled the sheet onto a blank second page. Emit one reserved box per anchor row, as tall as the tallest shape on it, and place each shape at its own horizontal offset inside it. Charts stay ordinary flow content. On the regression fixture the three shapes now share a top of 246 px and the workbook exports to one page. The 5% fuzz pixel difference against the native Excel export falls from 290,500 to 121,943. The remaining offset from Excel's 188 px, and the undersized shape bounds, are the anchor metrics tracked in #460. `generate_sheet_anchor` is gone: its text-box and image arms were dead once every placed drawing routed through the row emitter, and charts call `generate_chart` directly. Fixes #459 Signed-off-by: Yonghye Kwon <developer.0hye@gmail.com>
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.
Summary
generate_sheet_anchor, whose placed-drawing arms became deadRelated issue
Fixes #459
Details
Excel lays shapes anchored to the same row out side by side over the grid. office2pdf reserved a full-width flow box per shape, so each one advanced the flow before the next.
Shape top coordinate at 150 DPI:
The tripled reservation also spilled the sheet onto a blank second page; the workbook now exports to one page, as Excel does. The remaining offset from Excel's 188 px, and the undersized shape bounds, are the anchor metrics tracked in #460.
Testing
cargo fmt --all -- --checkcargo test --workspacecargo clippy --workspace --all-targets --all-featurespdfinfopage-count comparisonpdftoppm -r 150rendering, fill-bounds sampling, andmagick compare -metric AE -fuzz 5%Visual impact
Visual audit
tests/fixtures/xlsx/theme_color_drawing.xlsxpdftoppm, 150 DPIfixassets/bugfixes/issue-459/gt.jpgassets/bugfixes/issue-459/before.jpgassets/bugfixes/issue-459/after.jpgThe GT is the native Microsoft Excel export already captured for this fixture in #434, reused unchanged: same workbook, same page, same renderer, same 150 DPI.
Visual comparison
Required inspection
The 5% fuzz sweep against the size-normalized GT falls from 290,500 to 121,943 differing pixels. Every remaining cluster is the residual shape displacement and undersizing tracked in #460. The fixture has no hairlines, borders, or dashed strokes, and every run is regular weight with no italic or underline.
Deviation audit
Checklist
Signed-off-byline