What happened to simple-odf?
simple-odf was the only JavaScript library for creating OpenDocument files. It was last updated in 2021 and has known limitations that were never addressed: it generates flat XML files (.fodt) instead of proper ZIP-packaged .odt files, it has no support for tables, images, or page layout, and its npm package hasn't been updated in years.
If you're using simple-odf today, your generated documents are flat XML files that some applications handle inconsistently. A proper .odt file is a ZIP package containing XML, images, and metadata — which is what odf-kit generates.
Feature comparison
| Feature | odf-kit | simple-odf |
|---|---|---|
| Maintained | ✓ Active (2026) | ✗ Abandoned (2021) |
| Output format | ✓ Proper .odt ZIP | ✗ Flat XML (.fodt) |
| Template engine | ✓ Loops, conditionals, dot notation | ✗ Not supported |
| Tables | ✓ Widths, borders, merging | ✗ Not supported |
| Images | ✓ Embedded in ZIP | ✗ Not supported |
| Page layout | ✓ Margins, headers, footers | ✗ Not supported |
| Lists | ✓ Bullet & numbered, nested | Partial |
| Hyperlinks | ✓ External + internal bookmarks | Partial |
| TypeScript | ✓ | ✓ |
| Browser support | ✓ Node.js + browsers | ✗ Node.js only |
| Dependencies | 1 (fflate, 0 transitive) | 0 |
| Tests | 222 | ~50 |
Migration: side-by-side comparison
The API styles differ, but the concepts map directly. Here's how common operations translate:
Creating a document and adding text:
const { TextDocument } = require('simple-odf'); const doc = new TextDocument(); const body = doc.getBody(); body.addHeading('Hello'); body.addParagraph('World'); doc.saveFlat('doc.fodt');
import { OdtDocument } from "odf-kit"; import { writeFileSync } from "fs"; const doc = new OdtDocument(); doc.addHeading("Hello", 1); doc.addParagraph("World"); const bytes = await doc.save(); writeFileSync("doc.odt", bytes);
Key differences:
- odf-kit is ESM-only (
import, notrequire) - No
getBody()— methods are called directly on the document save()returns aUint8Array(proper .odt ZIP) instead of writing flat XML to disk- Headings take a level parameter (
1–6) - Text formatting uses an options object (
{ bold: true }) or builder callbacks
What odf-kit adds beyond simple-odf
After migrating your existing code, you get access to features simple-odf never had:
- Tables — array-of-arrays for simple tables, builder callback for borders, widths, merged cells, and formatted text in cells
- Images — embed PNG, JPEG, GIF, SVG, WebP, BMP, TIFF. Images stored inside the .odt ZIP.
- Page layout — page size, margins, orientation, headers with page numbers, footers
- Template engine — design documents in LibreOffice, fill them with data from code. Placeholders, loops, conditionals, dot notation. See the template guide.
- Bookmarks and internal links — named anchor points and cross-references within the document
- Browser support — same API works client-side in the browser. Generate documents without a server — user data never leaves the page.
Installation
Remove simple-odf and install odf-kit:
# Remove old library npm uninstall simple-odf # Install odf-kit npm install odf-kit
Make sure your package.json has "type": "module" (odf-kit is ESM-only) and you're running Node.js 18 or later.
Need help migrating?
If you run into issues, open an issue on GitHub. We're happy to help with specific migration questions.