feat(xlsx): print row and column heading gutters when printOptions asks - #723
Merged
Conversation
<printOptions headings="1"/> prints Excel's row-number gutter and column-letter strip beside the grid. The attribute was never read, so both gutters were missing from every page. Measured off the native Excel GT of NumberFormatTests (both sheets set the flag; both page sizes and 1-vs-3-digit row counts agree): the gutter is a fixed 22pt interior plus a 1pt black separator — it does not scale with digit count — and the strip 12pt plus its separator. Heading cells are unfilled; the rules between them are 1pt bands of constant #565656 (the PDF's 'gradient' shadings are degenerate single-colour functions), black between headings and data, and a 1pt black frame encloses the whole block on every page, shrinking to content on the partial last page. Digits and letters are the Normal font, regular weight, centred horizontally and seated on a baseline 3pt above the band bottom — Excel's ordinary bottom seat. The gutter is materialised as a real prepended column, so row numbers flow with Typst pagination, width packing, merges and drawings by construction; the strip is rows[0], re-emitted as a repeating header above print-title rows so every page carries letters, its bottom separator, and the frame's top edge. The strip's bottom boundary joins the repeating-header tie rules so a body top border cannot strip it from pages 2+, gridline seeding skips the frame-owned exterior, width pagination now packs the first column group against the full printable width, and non-left-anchored print-title columns keep their repeat (gutter yields; Excel repeats both — TODO with the multi-range reason). Verified against GT: separator and frame bands land on GT's exact boundaries, heading baselines within 0.10pt of the measured seat, row numbers continue to 337 across pages, letters repeat on every page. The one remaining frame gap — Typst-chosen page breaks leave the gutter's bottom span open on intermediate pages — is tracked in #722. Related: #623 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Yonghye Kwon <developer.0hye@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
<printOptions headings="1"/>prints Excel's row-number gutter and column-letter strip; the attribute was never read, so both gutters were missing from every page.Measured off the native Excel GT (both NumberFormatTests sheets, agreeing across Letter/A4 and 1-vs-3-digit row counts): the gutter is a fixed 22pt interior + 1pt black separator (it does not scale with digit count), the strip 12pt + separator; heading cells are unfilled with constant-#565656 1pt rules between them (the PDF "gradients" are degenerate single-colour shadings); a 1pt black frame encloses the block on every page, shrinking to content on the partial last page; digits/letters are the Normal font, regular, centred horizontally, seated 3pt above the band bottom.
Implementation materialises the gutter as a real prepended column (row numbers flow with Typst pagination, width packing, merges and drawings by construction) and the strip as
rows[0]re-emitted as a repeating header above print-title rows. The strip's bottom boundary joins the repeating-header tie rules (a body top border cannot strip it from pages 2+); gridline seeding (#622) skips the frame-owned exterior; width pagination packs the first column group against the full printable width; non-left-anchored print-title columns keep their repeat (gutter yields on overflow pages — Excel repeats both; TODO documents the multi-range requirement).Related issue
Fixes #623
Testing
cargo test --workspace— green (2100+ tests; ~25 new red-first tests across scanner, heading materialisation, base-26 letters, pagination slices, codegen repeat blocks, frame bands, descender seat, tie adoption, DOCX/PPTX guards)cargo +1.97 clippy --workspace --all-targets— clean;cargo fmt --check— cleanVisual impact
Visual audit
fixassets/bugfixes/issue-623/gt.jpgassets/bugfixes/issue-623/before.jpgassets/bugfixes/issue-623/after.jpgVisual comparison
Required inspection
Deviation audit
Checklist
Signed-off-byline🤖 Generated with Claude Code