I didn't want to extend the library itself, so I built tinydocx: <1K lines of TypeScript, zero dependencies, 7.7KB minified+gzipped. The popular docx package is 108KB with 5 dependencies.
What's included: - Text formatting (bold/italic/underline/strikethrough, colors, custom fonts) - Headings (H1-H6) - Tables with borders and column widths - Bullet and numbered lists (with nesting) - Images (PNG, JPEG, GIF, WebP) - Hyperlinks - Headers/footers with page numbers - Blockquotes and code blocks - Markdown to DOCX conversion - ODT (OpenDocument) support with the same API
What's not included: - Table of contents, footnotes, bookmarks - Track changes, comments - Multi-column layouts, text wrapping - Reading/modifying existing .docx files - Math equations, drawing shapes
DOCX files are just ZIP archives containing XML. Once you understand the structure, generating simple documents is straightforward. The hard part is knowing which XML elements Word actually requires vs. what's optional cruft.
Works great for invoices, reports, form letters - anything where you want the recipient to edit the document. Pairs nicely with tinypdf when you need both formats.
GitHub: https://github.com/Lulzx/tinydocx npm: npm install tinydocx