@office-open/doc
v0.15.1
Published
Parse legacy Microsoft Word .doc documents into office-open DocumentOptions — no Microsoft Office required
Maintainers
Readme
@office-open/doc
Parse legacy Microsoft Word 97-2003
.docdocuments into plainDocumentOptionsJSON — no Microsoft Office required.
Features
- 📄 Document Parsing — Read body content, sections, headers, and footers
- ✍️ Rich Text — Preserve text runs and character formatting
- 📊 Tables — Read table structure, rows, cells, and merged cells
- 🖼️ Images — Extract embedded pictures
- 🔗 Hyperlinks — Resolve internal and external link targets
- 🔖 Bookmarks — Read bookmark starts and ends
- 📝 Fields — Capture field instructions and cached results
- 🕘 Revisions — Read insertion and deletion revision ranges
- 🔐 Encrypted Files — Parse password-protected documents with the provided password
This package is parse-only. It does not generate .doc files.
Installation
# pnpm
pnpm add @office-open/doc
# npm
npm install @office-open/doc
# yarn
yarn add @office-open/doc
# bun
bun add @office-open/docQuick Start
import { parseDocument } from "@office-open/doc";
import { readFileSync } from "node:fs";
const options = parseDocument(new Uint8Array(readFileSync("input.doc")));For an encrypted document, provide the password:
const options = parseDocument(data, { password: "secret" });API
parseDocument(data, options?)— read a.docfile intoDocumentOptionsDocParseOptions— parse-time options, includingpasswordDocParseError— thrown for invalid, truncated, unsupported, or encrypted input, with canonicalcontextfields
Errors and Limitations
- Invalid, truncated, unsupported, and encrypted files throw
DocParseError. - Unsupported legacy records are skipped without aborting the document; their omissions are visible in canonical context.
- DOC generation is intentionally unavailable.
Documentation
- Documentation — additional format guides and examples
- Report Issues — bug reports and feature requests
Related Packages
- office-open — all formats + CLI + AI SDK tools in one install
- @office-open/docx — Word (.docx) generation and parsing
- @office-open/xls — legacy Excel (.xls) parsing
- @office-open/ppt — legacy PowerPoint (.ppt) parsing
