fix: honor category-axis number formats - #1556
Merged
Merged
Conversation
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
Honor
catAx/numFmtwhen rendering numeric category-axis labels. The budget workbook declares;;, so Excel leaves the category-label band blank while office2pdf printed 1, 2, and 3. Preserve the original category slots and chart geometry, formatting only the visible labels for bar, column, line, area, and radar charts.Retain the category format in
Chartand reuse the XLSX literal-section decoder for empty or quoted sections. This also works with published umya-spreadsheet 2.3.3; the corresponding dependency correction has already merged upstream in MathNya/umya-spreadsheet#361. Numeric formats continue through the existing formatter. Text categories retain their text.Related: #1267.
Testing
cargo test --locked -p office2pdf --lib category_number_format(3 passed): real chart XML, five axis-chart families, positive/negative/zero values, empty sections, numeric formatting, text categories, and quoted semicolons.cargo test --locked --workspace(passed, including integration tests and doctests)cargo check --locked --workspacecargo clippy --locked --workspace --all-targets -- -D warningscargo fmt --all -- --checkpython3 -m unittest discover -s scripts/tests -p 'test_*.py'(389 passed)git diff --checkpdftotext -layoutcontent matches native on both pages.Reproduce conversion with
cargo run --locked -p office2pdf-cli -- tests/fixtures/xlsx/issue_1181_fit_to_height.xlsx -o output.pdf --font-path '/Applications/Microsoft Excel.app/Contents/Resources/DFonts'. Compare the native and output PDFs withscripts/compare_layout.py GT.pdf output.pdf --audit --fine-shift 0.5 --json,scripts/compare_text_layer.py GT.pdf output.pdf, andscripts/compare_render.py GT.pdf output.pdf --page P --dpi DPI --fine-shift 0.5 --cluster-report PATH --cluster-dispositions PATH --strict-clusters(page 1: 150 DPI; page 2: 300 DPI).Visual impact
Visual audit
tests/fixtures/xlsx/issue_1181_fit_to_height.xlsx(SHA-2562b4a2d8dceda58758593c88409875efbda05780559154c02bd13fef4f7a1c65b)fixassets/bugfixes/issue-1267/layout-audit.jsonassets/bugfixes/issue-1267/render-clusters-page-1.json,assets/bugfixes/issue-1267/render-clusters-page-2.jsonassets/bugfixes/issue-1267/gt.jpgassets/bugfixes/issue-1267/before.jpgassets/bugfixes/issue-1267/after.jpgVisual comparison
Native Excel 16.112.3 exports, verified Excel/Quartz PDF provenance. Page 2 at 300 DPI:
The unchanged page-1 native comparison is attached to #1550, #1551, and #1552.
Required inspection
Deviation audit