Getting Started
Introduction
Overview of the office-open project and its packages
office-open is a TypeScript monorepo for Office documents. It provides declarative APIs to create .docx, .pptx, and .xlsx files, plus parsing for legacy formats without needing Microsoft Office installed.
#Monorepo Structure
The project is organized into packages, each with a focused responsibility:
#office-open
The unified package that re-exports all document-specific packages and provides shared utilities:
- Re-exports
@office-open/docx,@office-open/pptx,@office-open/xlsx,@office-open/doc,@office-open/xls,@office-open/ppt,@office-open/rtf,@office-open/odt,@office-open/ods,@office-open/odp,@office-open/core, and@office-open/xml - Includes a CLI for generating documents from JSON files
- Provides JSON Schemas for validating document options
- Provides AI SDK tools for DOCX, PPTX, XLSX, ODT, RTF, ODS, and ODP generation
- Provides a unified
generate()function for all document types
Install this package when you need multiple document types or AI integration.
#@office-open/core
The foundational shared package. Provides:
- Common XML components used across document types
- Value validation utilities
- OOXML formatting helpers
- Unit converters (e.g., EMU, points, twips)
You typically don't install this package directly — it's a dependency of the document-specific packages.
#@office-open/xml
XML parsing and serialization layer:
- Converts XML strings to JSON-compatible object trees
- Serializes object trees back to XML strings
- Handles OOXML-specific XML conventions (namespaces, prefixes)
#@office-open/docx
Word document generation:
- Create
.docxfiles with paragraphs, tables, images, headers, footers, and more - Support for styles, sections, page layout, and numbering
- Export to
Buffer(Node.js) orBlob(browser)
#@office-open/pptx
PowerPoint presentation generation:
- Create
.pptxfiles with slides, shapes, images, and charts - Support for slide layouts, masters, and transitions
- Export to
Buffer(Node.js) orBlob(browser)
#@office-open/xlsx
Excel spreadsheet generation:
- Create
.xlsxfiles with worksheets, cells, styles, charts, and formulas - Support for cell merging, frozen panes, auto-filters, and data validation
- Export to
Buffer(Node.js) orBlob(browser)
#Additional Formats
@office-open/doc,@office-open/xls, and@office-open/pptparse legacy binary documents into the matching OOXML option models@office-open/rtfgenerates and parses RTF withDocumentOptions@office-open/odt,@office-open/ods, and@office-open/odpread and write their ODF documents; internal@office-open/odfcode owns the container, generic nodes, and low-level chart and database codecs
#How It Works
- You describe your document as a JSON object (e.g.,
{ sections: [...] }) and pass it togenerateDocument() - Each property maps to OOXML markup
- The generate function serializes the options into an Office Open XML package (ZIP archive)
- You receive a
BufferorBlobready to save or serve