Skip to content

XLSX: drawing anchors honour the declared defaultRowHeight where Excel recomputes it from the Normal font, so pictures over default rows are 12% short #715

Description

@developer0hye

Summary

Drawing anchors on a sheet resolve row extents from the declared
sheetFormatPr defaultRowHeight (anchored_image::row_height_at,
crates/office2pdf/src/parser/xlsx.rs:197-206: row dimension → sheetFormatPr default →
15.0). Excel for Mac does not honour that declared default when laying out rows that carry
no explicit height: it recomputes the default row height from the workbook Normal font and
lays the rows out at 17pt where WithDrawing.xlsx declares defaultRowHeight="15". Every
drawing anchored across default rows is therefore ~2pt/row short in height and its
from_row offset drifts accordingly.

Measured

WithDrawing.xlsx sheet 1 (Calibri 11 Normal font, defaultRowHeight="15"), local
Excel-for-Mac GT export vs the #620 fix build:

GT (Excel) office2pdf
clock.jpg height (rows 0→8 + 12pt rowOff) 148pt (8 × 17 + 12) 132pt (8 × 15 + 12)
tomcat.png height 79pt 69pt
clock.jpg aspect 1.074 1.150

The 17pt/row hypothesis reconciles both heights exactly (8 rows × 2pt = 16pt = 148 − 132;
tomcat's rows likewise). The independent cols probe (openpyxl, Calibri 11,
defaultRowHeight 15) reproduces the same 17pt GT rows with no <cols> involvement.

Reproduction

cargo run -p office2pdf-cli -- tests/fixtures/xlsx/poi/WithDrawing.xlsx -o out.pdf
mutool draw -F trace -o - out.pdf 1 | grep fill_image   # clock 151.74 x 132; GT 159 x 148

Expected

Row extents under drawing anchors match Excel's printed default row height for the
workbook's Normal font (17pt for Calibri 11 on the Mac export path), not the stored
defaultRowHeight hint.

Actual

Rows resolve at the declared 15pt, so pictures anchored across default rows are ~12% short
and aspect-distorted even after the #620 column-metric fix.

Related: #620 #658 #710

Found in: the #620 fix-PR visual audit (WithDrawing.xlsx sheet 1, local Excel-for-Mac GT, 150 DPI, 2026-07-30). Visual comparison below.

Visual comparison

Compare
Compare

GT left, office2pdf right, 150 DPI, page 1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions