Skip to content

feat(excel): range style presets — set '/Sheet1/B2:T6' --prop stylepreset=… - #397

Open
ylz92871-dotcom wants to merge 1 commit into
iOfficeAI:mainfrom
ylz92871-dotcom:pr/style-preset-xlsx
Open

ylz92871-dotcom wants to merge 1 commit into
iOfficeAI:mainfrom
ylz92871-dotcom:pr/style-preset-xlsx

Conversation

@ylz92871-dotcom

Copy link
Copy Markdown

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 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.

…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.
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.

1 participant