Skip to content

feat(odf.js): add a real .sxc writer for OpenOffice.org 1.x - #894

Merged
Mearman merged 5 commits into
mainfrom
feat/odf-ooo1x-sxc-writer
Sep 3, 2026
Merged

feat(odf.js): add a real .sxc writer for OpenOffice.org 1.x#894
Mearman merged 5 commits into
mainfrom
feat/odf-ooo1x-sxc-writer

Conversation

@Mearman

@Mearman Mearman commented Sep 3, 2026

Copy link
Copy Markdown
Member

Progresses #821 (the .sxc quarter of it).

Adds writeSxc/writeSxcContent, the direct structural analogue of the existing .sxw writer (writeSxw/writeSxwContent, #878): writeSxc/writeSxcContent build a real ODF .ods Package through writeOds/writeOdsContent (#889) and run it through transformToOoo1Package, the same inverse transform the .sxw writer already uses. transformToOoo1Package is already generic across every ODF media type, so wiring .sxc up to it needed no changes to the transform itself -- only a second pair of writer entry points in src/ooo1/write.ts wrapping writeOds/writeOdsContent the way the .sxw pair already wraps writeOdt/writeOdtContent.

What it covers

Every construct writeOds/writeOdsContent can write, since a fix to the ODF writer fixes both formats at once: every office:value-type a cell can carry (number/percentage/currency/boolean/date/time/string, plus a value-less cell), runs with inline character formatting and hyperlinks, cell background/borders/alignment/vertical-alignment, verbatim formulas, merged ranges, column widths/hidden columns, row heights/hidden rows, cell-anchored images, print settings (gridlines/headers/page order/scale/fit-to-page/print range/repeated header rows-columns/manual page breaks), and multiple sheets.

What writeOds refuses by name (embedded objects, data-validation rules, conditional-formatting rules), writeSxc refuses too, for the same reason stated there: a document that silently lost semantic content would be worse than one this writer declined to produce at all.

.sxi/.sxd remain out of scope -- odf.js's typed layer still has no writeOdp/writeOdg for either to build on.

Verification

Round-tripped against the existing, unmodified readSxc/readSxcContent reader (untouched by this PR) -- the same proof #878 made for .sxw: genuine round-trip correctness against independently-built code, not merely internal self-consistency. A second, independent suite checks the package writeSxcContent produces actually looks like OpenOffice.org 1.x XML (no mimetype part, table:value-type/table:value rather than ODF's office:value-*, a bare style:properties rather than the typed style:table-cell-properties, a bare draw:image rather than a draw:frame wrapping one) rather than merely round-tripping because the transform's own passthrough tolerates whatever shape it was handed.

Full workspace lint/typecheck pass, and odf.js's own lint/typecheck/test/test:workers/test:smoke all green.

@Mearman
Mearman marked this pull request as ready for review September 3, 2026 19:25
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 3, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
🔒 Security Review Completed 2026-09-03T19:31:41.043983Z f206596 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

writeSxc/writeSxcContent build a real ODF .ods Package through
writeOds/writeOdsContent and run it through transformToOoo1Package, the
same inverse transform writeSxw/writeSxwContent already use -- the
transform is generic across every ODF media type, so wiring .sxc up to
it needed no changes there, only a second pair of writer entry points
wrapping writeOds/writeOdsContent the way the .sxw pair already wraps
writeOdt/writeOdtContent.
…ed reader

Mirrors ooo1/write.test.ts's own sxw suite exactly: a round-trip law
against readSxc/readSxcContent covering every cell value kind, runs,
formulas, decoration, merged ranges, column/row sizing, cell-anchored
images and print settings, plus a second suite proving the output
genuinely looks like OpenOffice.org 1.x XML -- no mimetype part,
table:value-type/table:value rather than ODF's office:value-*, a bare
style:properties rather than the typed style:table-cell-properties,
and a bare draw:image rather than a draw:frame wrapping one.
Updates the package README's status list, usage example, and src/ooo1/
module inventory for writeSxc/writeSxcContent. Also updates the root
README's package table row.
Keeps the export statement within this package's configured line length.
Three comments in transform.ts/read.ts still described this package's
typed layer as read-only for ODF and named writeSxw as the transform's
only caller -- both stopped being true once writeOdt/writeOds and
writeSxw/writeSxc landed. Also states plainly that transformToOoo1Package
is media-type-agnostic, which is exactly what let writeSxc reuse it
unchanged.
@Mearman
Mearman force-pushed the feat/odf-ooo1x-sxc-writer branch from 2322896 to 8eddaa6 Compare September 3, 2026 20:00
@Mearman
Mearman merged commit 897393b into main Sep 3, 2026
17 checks passed
@Mearman
Mearman deleted the feat/odf-ooo1x-sxc-writer branch September 3, 2026 20:04
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