Guide · Compliance · ISO/IEC 26300

ODF document generation for government compliance

Dozens of countries mandate the OpenDocument Format for public sector documents. If you're building software for government, non-profits, or any organization subject to open format requirements, here's how to generate compliant .odt files programmatically with JavaScript or TypeScript.

What is ODF and why do governments require it?

The OpenDocument Format (ODF) is an international standard for office documents, published as ISO/IEC 26300. Unlike proprietary formats such as .docx (OOXML), ODF is vendor-independent — it doesn't depend on any single company's software. Any application can implement it fully from the published specification.

This matters for governments because of digital sovereignty: the principle that public institutions should not be locked into a single vendor's ecosystem for critical infrastructure like document management. When a government stores its records in a proprietary format, it depends on that vendor's continued support, pricing decisions, and backwards compatibility. ODF eliminates that dependency.

ODF is the default format for LibreOffice, Apache OpenOffice, Collabora Online, and OnlyOffice. It is also supported by Google Docs and Microsoft Word (though Microsoft's implementation has historically been incomplete).

Where ODF is mandated

The following is a summary of known ODF mandates and formal recommendations for government use. This is based on research compiled by The Document Foundation and other public sources.

Supranational

OrganizationStatus
NATORequired for document exchange across all 28 member countries
United NationsFavors open formats for reports, policy drafts, and inter-agency collaboration
European CommissionPromotes ODF through its open source software strategy; used internally by the European Parliament, the Commission, and the EUIPO

Europe

CountryStatus
GermanyODF to be the standard for public administration by 2027. Ministry of Foreign Affairs and several federal courts already use ODF exclusively.
FranceODF recommended as preferred format under the Référentiel Général d'Interopérabilité (RGI)
ItalyDigital Administration Code permits only ODF; OOXML does not meet the code's open standard criteria
NetherlandsODF mandated for all public sector data exchange; compliance actively monitored
United KingdomODF adopted in 2014 as the sole standard for sharing and collaborating on editable documents across the public sector
BelgiumAll federal departments required to accept and read ODF since 2007
DenmarkODF mandated for state authorities for document exchange and archiving since 2011
Spain (Andalusia, Extremadura)ODF required for government-to-government and government-to-citizen communication
SlovakiaAll public authorities must be able to read and use ODF
SwitzerlandODF recommended for document exchange with citizens and other agencies
FinlandMinistry of Justice and other ministries have adopted ODF as the main document format

Americas, Asia, and Africa

CountryStatus
BrazilProprietary formats prohibited in federal administration since 2010; ODF is the standard
IndiaODF is the preferred format under the policy on open standards for e-governance
TaiwanODF tools deployed in all schools; local governments use LibreOffice
South AfricaODF listed as an accepted format under the MIOS policy
UruguayODF required for editable public documents
VenezuelaODF 1.0 required for all federal government editable documents
Argentina (Misiones)ODF mandatory within government organizations

The developer's problem

The mandate is clear — use ODF. But if you're building a web application, a reporting system, or an automation pipeline that needs to generate documents, you need a library that produces valid .odt files. Until recently, the JavaScript and TypeScript ecosystem had no actively maintained option. The most commonly referenced library, simple-odf, was abandoned in 2023 and never produced proper ZIP-packaged .odt files that could open in LibreOffice.

odf-kit fills that gap. It generates valid ODF 1.2+ compliant .odt files from JavaScript or TypeScript, works in Node.js and browsers, has zero runtime dependencies, and is actively maintained under the Apache 2.0 license.

Quick start — generating a compliant document

$ npm install odf-kit
import { OdtDocument } from "odf-kit";
import { writeFileSync } from "fs";

const doc = new OdtDocument();

doc.setMetadata({
  title: "Annual Budget Proposal",
  creator: "Department of Finance",
  description: "FY 2027 proposed budget allocation",
});

doc.setPageLayout({ orientation: "portrait" });
doc.setHeader("CONFIDENTIAL — Page ###");
doc.setFooter("Department of Finance — FY 2027");

doc.addHeading("Annual Budget Proposal", 1);
doc.addParagraph("Fiscal Year 2027 — Prepared for City Council");

doc.addHeading("Allocation by Department", 2);
doc.addTable([
  ["Department",    "Requested", "Approved"],
  ["Public Works",  "$4.2M",    "$3.8M"],
  ["Education",     "$8.1M",    "$7.9M"],
  ["Public Safety", "$6.5M",    "$6.5M"],
  ["Parks",         "$1.1M",    "$0.9M"],
], { border: "0.5pt solid #000" });

doc.addHeading("Notes", 2);
doc.addList([
  "All figures are preliminary and subject to council vote",
  "Education allocation includes $500K for technology upgrades",
  "Public Safety allocation unchanged from FY 2026",
], { type: "numbered" });

const bytes = await doc.save();
writeFileSync("budget-proposal.odt", bytes);

The output file opens correctly in LibreOffice, Google Docs, and Microsoft Word. It contains proper ODF XML structure with styles, metadata, and formatting — not a renamed HTML file or a flat XML dump.

Template-based generation for standardized forms

Many government workflows use standardized document templates — resolutions, permits, notices, reports with a fixed layout. odf-kit's template engine lets you create these templates in LibreOffice (where non-technical staff can design them) and fill them with data from your application:

import { fillTemplate } from "odf-kit";
import { readFileSync, writeFileSync } from "fs";

const template = readFileSync("resolution-template.odt");

const result = fillTemplate(template, {
  resolution_number: "2027-042",
  date: "March 15, 2027",
  title: "Approval of FY 2027 Budget",
  council_members: [
    { name: "Maria Santos", vote: "Yes" },
    { name: "James Chen",   vote: "Yes" },
    { name: "Anya Patel",   vote: "No" },
  ],
  showAppendix: true,
  appendix: "See attached financial summary.",
});

writeFileSync("resolution-2027-042.odt", result);

The template uses {placeholder} syntax: {resolution_number}, {date}, and so on. Loops use {#council_members}...{/council_members} to repeat a section for each array item. Conditionals use the same syntax with a boolean: {#showAppendix}...{/showAppendix} includes the section only when the value is truthy.

Browser-based generation for citizen-facing applications

odf-kit also works entirely in the browser — no server required. This is particularly relevant for government applications where data privacy is critical. A citizen filling out a form on a government website can generate their document locally, without their data ever being transmitted to a server:

import { OdtDocument } from "odf-kit";

async function generatePermit(formData) {
  const doc = new OdtDocument();
  doc.addHeading("Building Permit Application", 1);
  doc.addParagraph(`Applicant: ${formData.name}`);
  doc.addParagraph(`Property: ${formData.address}`);
  doc.addParagraph(`Date: ${new Date().toLocaleDateString()}`);

  const bytes = await doc.save();

  // Download — data never leaves the browser
  const blob = new Blob([bytes], {
    type: "application/vnd.oasis.opendocument.text",
  });
  const url = URL.createObjectURL(blob);
  const a = document.createElement("a");
  a.href = url;
  a.download = "permit-application.odt";
  a.click();
  URL.revokeObjectURL(url);
}

See the full browser generation guide for more details on client-side usage.

Why not just use LibreOffice on the server?

Many developers generate ODF documents by running LibreOffice in headless mode on a server (libreoffice --headless --convert-to odt). This works but comes with significant trade-offs: LibreOffice is a 500+ MB dependency that requires a full installation, process management, and careful resource allocation. It's slow to start, hard to scale, and unavailable in serverless or edge environments. It also cannot run in the browser.

odf-kit is a lightweight alternative: a 50 KB npm package with zero dependencies that generates .odt files directly from JavaScript. It runs anywhere JavaScript runs — Node.js, browsers, Deno, Bun, Cloudflare Workers. For document creation and template filling, it's a simpler and more scalable approach. If you need full document conversion (e.g., .odt to PDF), LibreOffice is still the right tool for that specific task.

What odf-kit generates

odf-kit produces standard ODF 1.2+ .odt files — proper ZIP archives containing content.xml, styles.xml, meta.xml, manifest.xml, and the mimetype entry. The output passes validation and opens correctly in all ODF-compliant applications. The library supports headings, paragraphs, formatted text (bold, italic, underline, color, font), tables with borders and cell formatting, numbered and bulleted lists, images, hyperlinks, bookmarks, headers and footers with page numbers, page layout and margins, and document metadata.

License and availability

odf-kit is free and open source under the Apache 2.0 license. There are no usage fees, no per-document charges, and no premium tiers. It's published on npm and the source code is available on GitHub. It's registered in the Developers Italia catalog for Italian public administration and listed on The Document Foundation's community resources.

Learn more

For step-by-step tutorials, see the Node.js generation guide, the browser generation guide, and the template filling guide. For a comparison with the abandoned simple-odf library, see the simple-odf alternative page.

Generate ODF-compliant documents from JavaScript

Works in Node.js and browsers. Zero dependencies. Apache 2.0.

$ npm install odf-kit