feat(excel): range style presets — set '/Sheet1/B2:T6' --prop stylepreset=… - #397
Open
ylz92871-dotcom wants to merge 1 commit into
Open
ylz92871-dotcom wants to merge 1 commit into
ylz92871-dotcom wants to merge 1 commit into
Conversation
…eset=…
What: six one-command presets for free-form ranges — table_header,
table_banded, kpi_card, metric_positive, metric_negative, note_gray. Each
preset is a bundle of EXISTING cell style props (fill, font.color, bold,
size, italic, alignment.horizontal) expanded through the same
ApplyCellProperties path a hand-written set uses ("expand, don't invent" —
mirrors WordHandler.StylePreset from iOfficeAI#376), so nothing a preset requests
can render as something else. Accent-keyed colors (ACCENT1/ACCENT1_TINT)
resolve from the workbook theme part at apply time with the Office default
fallback (4472C4) when no theme part exists. table_banded stripes the odd
range-rows and refuses ranges taller than 1000 rows, pointing at
`add --type table` for native banding. Unknown presets fail listing the
available names; cell-anchored stylepreset hard-rejects pointing at the
range form. Explicit cellProps in the same call apply first — the preset
wins conflicts deterministically.
Why: dashboards and reports need the same handful of range looks (header
band, zebra rows, KPI cards, good/bad metrics, muted notes) — hand-writing
five style props per range is error-prone and agents drift between
conventions. Pure sugar: the expansion adds no new style semantics, so
the break radius is zero.
How to verify:
officecli set data.xlsx '/Sheet1/B2:T6' --prop stylepreset=kpi_card
officecli set data.xlsx '/Sheet1/A2:A41' --prop stylepreset=table_banded
(unknown name → invalid_value with the full preset list)
Build 0 errors; local harness T-12 23 assertions green — including the
equivalence contract (preset expansion attribute-identical to the
hand-written primitive sequence, tint recomputed from the theme readback)
plus banded stripe/cap/error paths and the semantic color pairs.
Regression moat 26/26.
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.
feat(excel): range style presets — set '/Sheet1/B2:T6' --prop stylepreset=…
What: six one-command presets for free-form ranges — table_header,
table_banded, kpi_card, metric_positive, metric_negative, note_gray. Each
preset is a bundle of EXISTING cell style props (fill, font.color, bold,
size, italic, alignment.horizontal) expanded through the same
ApplyCellProperties path a hand-written set uses ("expand, don't invent" —
mirrors WordHandler.StylePreset from #376), so nothing a preset requests
can render as something else. Accent-keyed colors (ACCENT1/ACCENT1_TINT)
resolve from the workbook theme part at apply time with the Office default
fallback (4472C4) when no theme part exists. table_banded stripes the odd
range-rows and refuses ranges taller than 1000 rows, pointing at
add --type tablefor native banding. Unknown presets fail listing theavailable names; cell-anchored stylepreset hard-rejects pointing at the
range form. Explicit cellProps in the same call apply first — the preset
wins conflicts deterministically.
Why: dashboards and reports need the same handful of range looks (header
band, zebra rows, KPI cards, good/bad metrics, muted notes) — hand-writing
five style props per range is error-prone and agents drift between
conventions. Pure sugar: the expansion adds no new style semantics, so
the break radius is zero.
How to verify:
officecli set data.xlsx '/Sheet1/B2:T6' --prop stylepreset=kpi_card
officecli set data.xlsx '/Sheet1/A2:A41' --prop stylepreset=table_banded
(unknown name → invalid_value with the full preset list)
Build 0 errors; local harness T-12 23 assertions green — including the
equivalence contract (preset expansion attribute-identical to the
hand-written primitive sequence, tint recomputed from the theme readback)
plus banded stripe/cap/error paths and the semantic color pairs.
Regression moat 26/26.