Skip to content
Office Open

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
pnpm add office-open

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

#Individual Packages

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

pnpm
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:

html
<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.

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

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

#Requirements

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