Generate Office Open XML documents.

Create .docx, .pptx, and .xlsx files from plain JSON or fully typed TypeScript — a natural fit for AI agents and hand-written code alike.
{
    "sections": [
        {
            "children": [
                { "paragraph": { "children": [{ "text": "Hello, World!", "bold": true }] } }
            ]
        }
    ]
}
  • JSON & TypeScript
    Define documents as plain data — zero classes, zero boilerplate — with frozen JSON Schemas for tool-calling.
  • Rich Content
    Paragraphs, tables, charts, images, SmartArt, math equations, headers, footers, and more.
  • Type-safe
    Comprehensive TypeScript definitions power autocomplete and catch errors as you type.
  • Cross-platform
    Runs in Node.js, browsers, Deno, and Bun; export to Buffer, Blob, Base64, stream, or string.
  • OOXML Complete
    Every OOXML Transitional element and attribute, both generating and parsing — output opens in every major office suite.
  • Modular Packages
    Install just the format you need, or the unified package with CLI and AI SDK tools on top.

Build documents with JSON or TypeScript

Define documents as plain JSON objects, or reach for the TypeScript API for a full IDE experience. Both produce the same valid OOXML markup.
  • Create Word documents with paragraphs, tables, images, and charts
  • Create PowerPoint presentations with shapes, animations, and transitions
  • Create Excel spreadsheets with styles, charts, and data validation
  • High Performance with native zlib compression and streaming output
{
    "sections": [
        {
            "children": [
                {
                    "table": {
                        "rows": [
                            { "cells": [{ "children": [{ "paragraph": "Name" }] }, { "children": [{ "paragraph": "Role" }] }] },
                            { "cells": [{ "children": [{ "paragraph": "Alice" }] }, { "children": [{ "paragraph": "Engineer" }] }] },
                            { "cells": [{ "children": [{ "paragraph": "Bob" }] }, { "children": [{ "paragraph": "Designer" }] }] }
                        ]
                    }
                }
            ]
        }
    ]
}

Read and modify existing files

Parse .docx, .pptx, and .xlsx files into structured objects, or patch templates by replacing {{placeholder}} tokens with new content.
  • Read document structure, styles, and content
  • Patch template placeholders with new content
  • Parse, modify, and re-export in a pipeline
import { parseDocument, patchDocument } from "@office-open/docx";

// Parse existing file
const opts = parseDocument(buffer);
// opts.sections — document sections
// opts.title, opts.creator — core properties

// Patch template placeholders
const result = await patchDocument({
  outputType: "nodebuffer",
  data: buffer,
  placeholders: {
    name: { type: "paragraph", children: [{ text: "John" }] },
  },
});

Add document generation to your project.

Copyright © 2026