fix(xlsx): lay chart content out on the frame's fitted sheet origin - #1747
Merged
Merged
Conversation
An anchored worksheet chart's plot, gridlines, labels and legend were laid out from the converter's physical page origin while its frame was painted on Excel's fitted sheet-space origin (#1542). At the gift workbook's 0.82 fit scale the two origins differ by 0.854 sheet points, and the #1250 chrome model had absorbed that gap: a 10.146pt top inset and an 11.853pt bottom pad reproduced the native plot only there. On the unscaled control, where the origins coincide, the whole plot printed 0.854pt high and its whole-point gridlines re-rounded one point off native. Native Excel for Mac 16.112 exports of the same chart at 100% and at 0.82, and the 0.78 export of #1272, all put the plot 11 sheet points inside the frame at the top and keep an 11pt bottom edge pad, the flat inset Excel already uses on the right. The chart content now shares the frame's origin, the two vertical insets are that 11pt, the bottom-legend seat is re-based by the same 0.853pt, and the paint-offset plumbing that kept the content on the old origin is gone. The unscaled control's gridlines, value labels, category labels and legend now trace at the native page coordinates; the fitted chart keeps its matched vertical geometry and its x moves 0.185pt onto the native plot edge. Related: #1607 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> 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.
File submission policy
Before attaching or committing files, read the submission policy.
Summary
An anchored worksheet chart's content (plot, gridlines, value and category labels, legend, markers) was laid out from the converter's physical page origin while its frame was painted on Excel's fitted sheet-space origin (#1542). At the gift workbook's 0.82 fit scale the two origins differ by 0.854 sheet points, and the #1250 chrome model had absorbed that gap: a 10.146pt top inset and an 11.853pt bottom pad reproduced the native plot only there. On the unscaled control, where the origins coincide, the whole plot printed 0.854pt high and its whole-point gridlines re-rounded one point off native.
Native Excel for Mac 16.112 exports of the same chart at 100% and at 0.82 (the fresh exports recorded for #1598 and #1600), and the 0.78 export measured for #1272, all put the plot 11 sheet points inside the frame at the top and keep an 11pt bottom edge pad, the flat inset Excel already uses on the right. The chart content now shares the frame's origin, the two vertical insets are that 11pt, the bottom-legend seat is re-based by the same 0.853pt, and the
sheet_paint_offset_ptplumbing that kept the content on the old origin (write_offset_paint_box_start,WorksheetMarkerPlacement::plot_offset) is removed. The unscaled control's gridlines, value labels, category labels and legend now trace at the native page coordinates; the fitted chart keeps its matched vertical geometry and its x moves 0.185pt onto the native plot edge.Related: #1607
Related issue
Related: #1607. Filed from this audit: #1745 (series not clipped to the whole-point plot rectangle) and #1746 (unscaled centred tile keeps a fractional horizontal origin). The January and June column edges are recorded on #1735.
Testing
cargo test --locked -p office2pdf --lib: 3082 passed.worksheet_column_plot_edges_follow_native_at_every_print_scalepins the plot's top and bottom rules at the native page coordinates for both 1.0 (143.0126 / 391.1924pt) and 0.82 (126.2903 / 329.7977pt);fitted_drawing_frames_carry_chart_text_with_the_frame,..._carry_the_plot_edges_with_the_frameand..._carry_the_legend_key_with_the_framereplace the XLSX charts: fitted drawing foreground keeps the physical page origin #1542 tests that pinned the old split; the Charts: an anchored sheet chart's plot area is 1.27pt short vertically, so its gridlines drift up to 1.14pt off the export's #1250/Charts: worksheet chart gridlines ignore Excel whole-point snapping #1471/Charts: a fitted worksheet column remains 0.53pt too narrow #1543 chart-local tests are re-based onto the frame Excel paints.cargo +1.97 clippy --locked --workspace --all-targets -- -D warnings,cargo fmt --all --checkandgit diff --checkpass.compare_layout.py --audit --fine-shift 0.5 --noise-floor 0.5page 2 fine shifts 14 → 1 (budgeted, XLSX: each line of a multi-line wrapped centred cell keeps Typst's centring where Excel seats it on the whole-point grid #1738), rectangle geometry findings 4 → 1 (XLSX: unscaled column-chart bar left edge lands one sheet point right of native #1735); page 3 unchanged (its two 0.225pt band-edge findings are pre-existing onmain, XLSX: an unscaled centred sheet keeps a fractional horizontal origin where Excel prints each tile on a whole sheet point #1746). Strict 300 DPI cluster gates: page 2 84/84 and page 3 9/9 dispositioned (XLSX: unscaled column-chart bar left edge lands one sheet point right of native #1735, XLSX: worksheet chart series are not clipped to Excel's whole-point plot rectangle, so a zero-value line paints over the category axis #1745, XLSX: an unscaled centred sheet keeps a fractional horizontal origin where Excel prints each tile on a whole sheet point #1746-remainder glyph fragments and accepted renderer classes).compare_text_layer.py: no class injected; the content residual is the clipped chart runs of XLSX: chart text clipped on a print tile stays in the neighbouring tile's text layer #1736.Visual impact
Visual audit
tests/fixtures/xlsx/issue_1603_gift_budget.xlsxwithxl/worksheets/sheet2.xmlpageSetUpPr/@fitToPagechanged fromtruetofalse(controlled package SHA-256af4160ca276c3add9e3100f80c8df7156afbdf6ec7a0090161e015a7ccf5d5cb); native export SHA-2560935ca38e497a657d2f972fb7ddfc3163cf69e8edfe6d79d230202b5db5d7bfafixassets/bugfixes/issue-1607/layout-audit.jsonassets/bugfixes/issue-1607/render-clusters-page-2.json,assets/bugfixes/issue-1607/render-clusters-page-3.jsonbudgetedheader line sits 0.51pt left (XLSX: each line of a multi-line wrapped centred cell keeps Typst's centring where Excel seats it on the whole-point grid #1738). Font faces, weights and colours match on every crop.assets/bugfixes/issue-1607/gt.jpgassets/bugfixes/issue-1607/before.jpgassets/bugfixes/issue-1607/after.jpgVisual comparison
Required inspection
Deviation audit
budgeted); the plot top/bottom, gridlines, value and category labels and legend rows are fixed onto the native rows.budgetedheader). Value labels right-aligned and category labels centred as native.Checklist
Signed-off-byline🤖 Generated with Claude Code