Generate Office Open XML documents.

Create .docx, .pptx, and .xlsx files with JSON or TypeScript. Ideal for AI agents and traditional workflows alike.
{
    "sections": [
        {
            "children": [
                { "paragraph": { "children": [{ "text": "Hello, World!", "bold": true }] } }
            ]
        }
    ]
}
JSON & TypeScript
Create documents with pure JSON objects or TypeScript classes. JSON-first design makes it ideal for AI agents and LLM workflows.
Rich Content
Paragraphs, tables, images, charts, SmartArt, math equations, headers, footers, and more.
Type-safe
Full type definitions and autocomplete out of the box. No additional @types packages needed.
Cross-platform
Works in Node.js and browsers. Export to Buffer, Blob, Base64, stream, or string.
OOXML Compliant
Generates files that fully comply with the ISO/IEC 29500 Office Open XML specification.
Modular Packages
Install only what you need — docx, pptx, xml, or core.

Build documents with JSON or TypeScript

Define documents as plain JSON objects — perfect for AI agents — or use TypeScript classes for a full IDE experience. Both produce 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
    Export to Buffer, Blob, Base64, stream, or string
{
    "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 for inspection, 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, PatchType } 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,
  patches: {
    name: { type: PatchType.PARAGRAPH, children: [new TextRun("John")] },
  },
});

Add document generation to your project.

Copyright © 2026