Skip to content

XLSX: a customFormat row style on trailing empty cells does not widen the print range, so a formatted empty column and its header fill are dropped #718

Description

@developer0hye

Summary

Excel extends a sheet's printed range to columns that carry formatting even when they hold
no cell value: a row-level customFormat style whose fill spans a trailing empty column
makes that column part of every printed page. office2pdf derives the printed range from
populated cells only, so a formatted-but-empty trailing column and its fill band are
dropped from the output entirely.

Measured

NumberFormatTests.xlsx Tests sheet, row 1 (customFormat style s=3, orange fill): GT
prints an empty 64pt column E on every one of the sheet's 8 pages, with the A1:E1 header
fill band spanning 461pt. office2pdf prints columns A–D only; the fill band measures 396pt.

GT (Excel) office2pdf
printed columns A–E A–D
header fill band width 461pt 396pt
empty formatted column E 64pt, present absent

Reproduction

cargo run -p office2pdf-cli -- tests/fixtures/xlsx/poi/NumberFormatTests.xlsx -o out.pdf
mutool draw -F trace -o - out.pdf 2 | grep fill_path   # header band 396pt; GT 461pt incl. column E

Expected

The printed range includes formatted-but-empty trailing columns, as Excel prints them.

Actual

Only populated columns print: the formatted empty column and its header fill vanish.

Related: #621

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

Visual comparison

Compare
Compare

GT left (Letter), office2pdf right (A4), 150 DPI, Tests sheet 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