Skip to content

feat(write): cell styles for xlsx and ods - #90

Merged
vaceslav merged 11 commits into
mainfrom
feat/write-styles
Oct 4, 2026
Merged

vaceslav merged 11 commits into
mainfrom
feat/write-styles

Conversation

@vaceslav

@vaceslav vaceslav commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Part 1 of the styled/columnar export (spec docs/superpowers/specs/2026-10-04-styled-columnar-export-design.md §1). Closes #86. Part of #67.

  • CellStyle (fill, font colour/bold/italic, number format, date format, horizontal alignment, wrap, thin border), CellColor, CellFont, CellBorder.
  • NumberFormat / DateFormat parse a supported subset of Excel format codes; anything else is refused at Parse, never at write time. Number and date formats are separate, so a date always keeps a date format.
  • writer.Style(style) → StyleId (stamped per writer; a foreign id is refused); Write(value, StyleId) overloads. Up to 4096 styles per file.
  • xlsx: styles.xml built at the end; ods: common cell styles and data styles in styles.xml, written at the end — styles may appear mid-stream. Csv ignores styles.
  • Each (style, value kind) is resolved once and cached: nothing allocated per styled cell (measured in all three formats).
  • Reader fix: a custom xlsx number format with a backslash or [ inside a quoted literal was misread as a date.
  • Verified with OpenXmlValidator, our own import (styled and unstyled rows read back the same), and LibreOffice (formats shown as stated; fills and bold survive xlsx→ods and ods→xlsx).
  • Allocation-counting tests run in a non-parallel collection: Gen2 collections from parallel tests trim the array pool and skew the counter.

@vaceslav
vaceslav merged commit 45dbca8 into main Oct 4, 2026
9 checks passed
@vaceslav
vaceslav deleted the feat/write-styles branch October 4, 2026 14:33
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.

Write: cell styles for xlsx and ods (fill, font, number/date formats, alignment, border)

1 participant