Skip to content

fix(xlsx): preserve literal zero format spacing - #1515

Merged
developer0hye merged 1 commit into
mainfrom
fix/issue-1262-zero-format-spacing
Sep 3, 2026
Merged

developer0hye merged 1 commit into
mainfrom
fix/issue-1262-zero-format-spacing

Conversation

@developer0hye

Copy link
Copy Markdown
Owner

Summary

  • preserve quoted and escaped whitespace in literal-only zero sections when the numeric cell value is exactly zero
  • use the same displayed value for table text and spill-boundary calculations
  • pin all 71 affected cells in the monthly-budget fixture and publish current-source visual evidence
  • keep the workaround deliberately narrow while the general dependency fix proceeds in Preserve whitespace in literal-only number format sections MathNya/umya-spreadsheet#362

Related issue

Fixes #1262.

Follow-up found during the closing audit: #1514.

Testing

  • cargo fmt --all -- --check
  • git diff --check
  • python3 -m unittest discover -s scripts/tests (326 passed)
  • cargo test -p office2pdf literal_zero_section_tests (3 passed)
  • cargo test -p office2pdf --test xlsx_fixtures structure_monthly_budget_zero_values_preserve_the_literal_zero_section -- --exact (1 passed)
  • cargo test --workspace (passed after refreshing the ignored local lock to the current docx-rs branch head and rebuilding a shared-target test binary whose embedded worktree fixture path was stale)
  • CARGO_INCREMENTAL=0 cargo clippy --workspace --all-targets -- -D warnings
  • cargo package -p office2pdf --allow-dirty (221 files packaged; crates.io dependency boundary compiled)
  • CARGO_INCREMENTAL=0 cargo check --target wasm32-unknown-unknown -p office2pdf
  • CARGO_INCREMENTAL=0 cargo check --target wasm32-unknown-unknown -p office2pdf --features wasm
  • CARGO_INCREMENTAL=0 cargo check --target wasm32-unknown-unknown -p office2pdf --features wasm-cjk-font
  • qpdf --check target/issue-1262/after-current-source.pdf
  • python3 scripts/compare_layout.py target/issue-1262/gt-clean.pdf target/issue-1262/after-current-source.pdf --noise-floor 0.5 --fine-shift 0.5 --audit --json (expected findings were dispositioned to open issues)
  • python3 scripts/compare_render.py target/issue-1262/gt-clean.pdf target/issue-1262/after-current-source.pdf --page 1 --dpi 300 --fine-shift 0.5 --artifacts-dir target/issue-1262/strict-after-300 --cluster-report assets/bugfixes/issue-1262/render-clusters-page-1.json --cluster-dispositions target/issue-1262/page-1-dispositions.json --strict-clusters
  • upstream umya-spreadsheet: cargo test --lib (119 passed) and cargo clippy --lib -- -D warnings on Preserve whitespace in literal-only number format sections MathNya/umya-spreadsheet#362

Visual impact

  • No rendered PDF change
  • Rendered PDF change or visual evidence added

Visual audit

Visual comparison

GT Before After
GT Before After

Required inspection

  • Rendered all evidence at 150 DPI or higher
  • Stored progressive JPEG quality 86 assets with metadata stripped
  • Used Codex/Claude vision to inspect the full GT/output pages, diff, and matched crops
  • Inspected matched region crops at full resolution
  • Ran compare_layout.py --audit --fine-shift PT and dispositioned every fine/large text-instance shift, painted-text visibility mismatch, and visible-fill occlusion
  • Ran compare_render.py --cluster-report PATH --strict-clusters and dispositioned every material 5% fuzz diff cluster by explicit ID
  • Inventoried hairlines and border dash styles
  • Inventoried font weight, italic, and underline emphasis

Deviation audit

Check Result
Page count/order Matches GT
Element presence Remaining: #1261, #1267, #1270
Position/size Remaining: #1185, #1265, #1266, #1272, #1380, #1510, #1514
Rotation/flip Matches GT
Fill Remaining: #1185, #1270
Stroke/border Remaining: #1185, #1261, #1271, #1274
Shape outline geometry Remaining: #1185, #1265, #1272
Text content Remaining: #1263, #1267, #1446; Fixed: #1262
Font family/weight/style Remaining: #1210, #1380
Text color Remaining: #1210
Alignment Remaining: #1265, #1266, #1272, #1380, #1510
Line/paragraph spacing Remaining: #1514
Clipping/overflow Remaining: #1263

Follow-up evidence

#1514 records the independent row-height snap discovered during this audit. Native Excel is on the left and the current office2pdf output is on the right, rendered at 300 DPI.

Native Excel and office2pdf row-pitch comparison

Checklist

  • Commits include a Signed-off-by line
  • PR scope contains one root cause
  • Remaining visual deviations each reference an open issue

Signed-off-by: Yonghye Kwon <developer.0hye@gmail.com>
@developer0hye
developer0hye merged commit b24bf92 into main Sep 3, 2026
18 checks passed
@developer0hye
developer0hye deleted the fix/issue-1262-zero-format-spacing branch September 3, 2026 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

XLSX: a number format's third section is ignored, so a zero prints 0 where Excel prints the declared literal

1 participant