Getting Started

Installation

How to install office-open packages

Unified Package

Install the office-open unified package when you need multiple document types, CLI support, or AI integration:

pnpm add office-open

The unified package re-exports all document-specific packages and provides the CLI, Zod schemas, and AI SDK tools.

Individual Packages

Or install only the specific package(s) you need:

pnpm add @office-open/docx
pnpm add @office-open/pptx
pnpm add @office-open/xlsx

Shared dependencies (@office-open/core, @office-open/xml) are pulled in automatically.

Browser

For browser usage, import directly from a CDN that supports ESM:

<script type="module">
  import { generateDocument } from "https://esm.sh/@office-open/docx";

  // ... create and export your document
</script>

Or use a bundler (Vite, Webpack, etc.) — the packages ship as standard ESM modules and work out of the box.

TypeScript

All packages are written in TypeScript and ship with complete type definitions, providing full autocomplete and type safety.

import { generateDocument } from "@office-open/docx";

// Full type support and autocomplete
const buffer = await generateDocument({
  sections: [
    {
      children: [{ children: [{ text: "Hello, World!", bold: true }] }],
    },
  ],
});

Requirements

  • Node.js >= 18
  • TypeScript >= 5.0 (optional, but recommended)
Copyright © 2026