Skip to content

fix(xlsx): inset data bars from the row edges like Excel#455

Merged
developer0hye merged 1 commit into
mainfrom
fix/xlsx-data-bar-height
Jul 25, 2026
Merged

fix(xlsx): inset data bars from the row edges like Excel#455
developer0hye merged 1 commit into
mainfrom
fix/xlsx-data-bar-height

Conversation

@developer0hye

@developer0hye developer0hye commented Jul 25, 2026

Copy link
Copy Markdown
Owner

Summary

  • Inset XLSX conditional-format data bars from the row's top and bottom edges instead of filling the cell content height.
  • Native Excel PDF exports of the business corpus print a 10 pt bar in every 14 pt row, which is 2 pt of clearance per side.
  • A floor keeps the bar visible in rows shorter than the inset.

Related issue

Fixes #418

Testing

  • cargo test --workspace (1817 tests, all pass)
  • cargo clippy --workspace --all-targets (clean)
  • cargo fmt --check
  • pdftocairo -svg on page 1 of both PDFs to read the rendered gradient geometry directly
  • pdftoppm -r 150 plus matched-region crops of the On Hand column at 300% scale

First data bar transform on page 1 of 03_inventory_en:

Render Transform Bar height
Excel GT matrix(36, 0, 0, 10, 326, 134) 10.000 pt
before matrix(36.203705, 0, 0, 13.184054, 325.606174, 132.443447) 13.184 pt
after matrix(34.85704, 0, 0, 9.188886, 325.606174, 134.441031) 9.189 pt

The height error moves from +31.8% to -8.1%, and the white gaps Excel leaves between consecutive bars are restored. The residual comes from the auto-height branch approximating the printed row track as 1.2em; these rows are content-driven because they contain a wrapping cell, so the calibrated 14 pt track is not available to the renderer.

Visual impact

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

Visual audit

  • Issue: XLSX: data bars render 31.8% taller than Excel #418
  • Fixture: tests/golden_mocks/business/sources/xlsx/03_inventory_en.xlsx
  • Page(s): 1
  • Renderer and DPI: pdftoppm, 150 DPI
  • Evidence mode: fix
  • New follow-up issues found in this audit: None
  • GT: assets/bugfixes/issue-418/gt.jpg
  • Before: assets/bugfixes/issue-418/before.jpg
  • After: assets/bugfixes/issue-418/after.jpg
  • Compare: assets/bugfixes/issue-418/compare.jpg

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
  • Inspected matched region crops at full resolution
  • Ran the 5% fuzz pixel-difference sweep
  • Inventoried hairlines and border dash styles
  • Inventoried font weight, italic, and underline emphasis

Deviation audit

Check Result
Page count/order Matches GT: four pages in the same order
Element presence Matches GT: every bar, value, and header cell is present
Position/size Fixed: bars are 9.189 pt tall against Excel's 10.000 pt, down from 13.184 pt
Rotation/flip No deviation observed
Fill Matches GT: the 638EC6 gradient and its lightened stop are preserved
Stroke/border Matches GT: the cell grid rules are present at matching positions
Text content Matches GT
Font family/weight/style Matches GT
Text color Matches GT
Alignment Matches GT
Line/paragraph spacing Matches GT: the 14 pt row tracks are unchanged
Clipping/overflow Fixed: bars no longer merge into neighboring rows

Checklist

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

Data bars were given the full cell content height, so they filled the row
and merged vertically into a continuous band. Native Excel insets them:
its PDF exports print a 10 pt bar in every 14 pt row of the business
corpus.

Subtract 2 pt of clearance per side, with a floor so short rows keep a
visible bar. On the inventory fixture the rendered bar height moves from
13.184 pt to 9.189 pt against Excel's 10.000 pt, and the row gaps Excel
leaves between bars are restored.

Fixes #418

Signed-off-by: Yonghye Kwon <developer.0hye@gmail.com>
@developer0hye
developer0hye force-pushed the fix/xlsx-data-bar-height branch from 4b642dc to e237775 Compare July 25, 2026 10:28
@developer0hye
developer0hye merged commit a40bf77 into main Jul 25, 2026
33 checks passed
@developer0hye
developer0hye deleted the fix/xlsx-data-bar-height branch July 25, 2026 10:53
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: data bars render 31.8% taller than Excel

1 participant