Skip to content

fix(xlsx): fill table cells to the full line height with Excel insets#410

Merged
developer0hye merged 3 commits into
mainfrom
fix/xlsx-cell-full-line
Jul 22, 2026
Merged

fix(xlsx): fill table cells to the full line height with Excel insets#410
developer0hye merged 3 commits into
mainfrom
fix/xlsx-cell-full-line

Conversation

@developer0hye

@developer0hye developer0hye commented Jul 22, 2026

Copy link
Copy Markdown
Owner

Summary

XLSX auto-height rows rendered ~22% taller than Excel — 17.15pt vs 14.0pt for a 10pt font (issue #396). Two causes:

  1. Single-line cells occupied only the metric box. A cell line used the font's ascender+descender (~0.94em); the single-spacing leading tops up the space between lines, so a one-line cell was left short and, with the default inset, the auto row overflowed. Cells now emit a fixed line box spanning the font's full hhea line (split by the ascender/descender ratio, zero leading) — the height Word gives a cell line. This also lifts DOCX Korean cells toward Word (18pt → 21pt; the residual to Malgun's own metrics is DOCX: table-cell rows render about 4.3pt shorter than Word #404).
  2. Typst's default 5pt vertical cell inset overflowed the row. XLSX tables now use ~1pt vertical / 2pt horizontal insets (the horizontal value the column-spill estimate already assumes).

Measured on 06_sales_dashboard_en.xlsx: row pitch drops from 17.15pt to 13.5pt against Excel's 14.0pt (0.5pt residual, no content clipped).

Related issue

Fixes #396

Testing

  • cargo test --workspace — green
  • Local bulk regression gate — PASS (shared cell-paragraph line-height path; the gate covers every DOCX/XLSX table fixture)
  • Updated the two table-cell line-height tests to the full-hhea-box contract
  • Converted 06_sales_dashboard_en.xlsx (rows match Excel) and 03_meeting_minutes_ko.docx (Korean cells taller, toward GT, no clipping)

Visual impact

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

Visual audit

  • Issue: XLSX: auto-height rows render ~22% taller than Excel #396
  • Fixture: 06_sales_dashboard_en.xlsx (synthetic real-world audit set, external)
  • 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-396/gt.jpg
  • Before: assets/bugfixes/issue-396/before.jpg
  • After: assets/bugfixes/issue-396/after.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
Element presence Matches GT
Position/size Fixed (row pitch 13.5pt vs Excel 14.0pt, was 17.15pt)
Rotation/flip No deviation observed
Fill Matches GT (color-scale cells, data bars)
Stroke/border Matches GT
Text content Matches GT
Font family/weight/style Matches GT
Text color Matches GT
Alignment Matches GT
Line/paragraph spacing Fixed (cells fill the full line box)
Clipping/overflow Matches GT (no cell content clipped)

Checklist

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

🤖 Generated with Claude Code

developer0hye and others added 3 commits July 22, 2026 14:57
XLSX auto-height rows rendered ~22% taller than Excel (17.15pt vs 14.0pt
for a 10pt font, issue #396). Two causes:

1. A single-line cell occupied only the font's metric box (ascender +
   descender, ~0.94em); the single-spacing leading tops up the space
   *between* lines, so a one-line cell was left short. Cells now emit a
   fixed line box spanning the font's full hhea line (split by the
   ascender/descender ratio, zero leading), the height Word gives a cell
   line. This also lifts DOCX Korean cells closer to Word (18pt -> 21pt;
   the remaining gap to Malgun's metrics is #404).
2. Typst's default 5pt vertical cell inset overflowed the row. XLSX
   tables now use ~1pt vertical / 2pt horizontal insets, the latter the
   value the column-spill estimate already assumes.

Verified: the sales-dashboard rows drop from 17.15pt to 13.5pt against
Excel's 14.0pt; no cell content is clipped.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Yonghye Kwon <developer.0hye@gmail.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Yonghye Kwon <developer.0hye@gmail.com>
The PR #186 acceptance test hard-coded the overlay geometry for the old
5pt cell padding; XLSX cells now use ~2pt insets (issue #396), so the
overlay offsets track the smaller padding (dx -2pt, length 100%+4pt).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Yonghye Kwon <developer.0hye@gmail.com>
@developer0hye
developer0hye merged commit 380b368 into main Jul 22, 2026
29 checks passed
@developer0hye
developer0hye deleted the fix/xlsx-cell-full-line branch July 22, 2026 06:40
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: auto-height rows render ~22% taller than Excel

1 participant