Skip to content

feat: add typed Excelize style extraction - #1

Merged
tomtwinkle merged 11 commits into
mainfrom
feat/get-excelize-style
Oct 13, 2026
Merged

tomtwinkle merged 11 commits into
mainfrom
feat/get-excelize-style

Conversation

@tomtwinkle

@tomtwinkle tomtwinkle commented Aug 19, 2022 •

Copy link
Copy Markdown
Owner

Add extraction and typed reuse of effective XLSX cell styles. The existing style helpers relied on incomplete, hand-maintained constants; generated enums and definitions now cover every public Style field in Excelize v2.10.1 while preserving custom values.

Changes

  • Document every enum type and constant in GoDoc, with references to the official Excelize Style documentation. Generate these comments and test their presence so regeneration preserves them.

  • Add excelizeutil.GetStyle for effective cell styles, including inherited formatting, colors, number formats, alignment, and protection.

  • Add GetStyleDefinition and generated StyleDefinition, BorderDefinition, FillDefinition, FontDefinition, AlignmentDefinition, and ProtectionDefinition with bidirectional Excelize conversion.

  • Generate public enums for categorical choices and all field names. Preserve arbitrary numeric/text values, booleans, nil pointers, and empty slices.

  • Parse Excelize AST tables and documentation for patterns, borders, fill types, gradients, alignment, fonts, number formats, languages, and public fields. Use explicit OOXML definitions where Excelize provides no enum table.

  • Generate gradient geometry and stop positions for the extractor. Preserve the existing style helper API and border-style aliases.

  • Refresh generated files with go generate ./excelizeutil; tests fail when they differ from the selected dependency.

Validation

  • go test ./... passes with Excelize v2.10.1 on the updated main tree.
  • Generation checks and whitespace checks pass.
  • Tests cover every public field's typed conversion, nil/empty values, upstream field/enum additions, unsupported source changes, and all generated pattern, border, and gradient values.
  • Workbook round-trip tests compare saved OOXML for fonts, colors, alignment, protection, and gradients.

Limits

Typed conversion preserves the complete public Style input. Workbook extraction remains limited by Excelize and OOXML representation: cell fill transparency, arbitrary gradient geometry, both pattern colors, and original formatting inputs cannot always be recovered. New upstream fields are added to definitions automatically, but their workbook extraction semantics still require review. See excelizestyle/README.md and excelizeutil/STYLE_COVERAGE.md.

@tomtwinkle
tomtwinkle marked this pull request as ready for review October 9, 2026 01:13
@tomtwinkle tomtwinkle changed the title feat: get excelize style util draft feat: add typed Excelize style extraction Oct 13, 2026
@tomtwinkle
tomtwinkle merged commit 5e97948 into main Oct 13, 2026
1 check passed
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