docxml is a TypeScript library for building and parsing .docx files (OXML format) from scratch or from templates. The current stable version is 5.15.1, released actively with several updates per year. Key differentiators include support for both Node.js and Deno, JSX syntax for declarative document composition, template rendering with parameterized DOTX files, and coverage of features like tables, images, headers/footers, change tracking, comments, and reference fields. It provides a fully typed API and supports both programmatic and XML-driven document creation.
npm install docxmlNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates a simple DOCX file with a centered paragraph and saves it to disk.
Use `Docx.fromJsx()` or `Docx.fromNothing()` to create documents.
Replace `new Document()` with `Docx.fromJsx()` or `Docx.fromNothing()`.
Add `/** @jsx Docx.jsx */` at the top of JSX files, or configure your transpiler to use `Docx.jsx` as the JSX factory.
Use `const { default: Docx } = require('docxml')` or switch to ESM imports.Ensure the output directory exists before calling `toFile()`, or use `toBuffer()` and write the buffer yourself.
Use the correct import map URL (e.g., from deno.land/x/docxml) or an npm specifier if using Node.
Use `const { default: Docx } = require('docxml')` or switch to ESM imports.Add `/** @jsx Docx.jsx */` at the top of the JSX file, or configure your transpiler to use `Docx.jsx`.
Create the directory before calling `toFile()`, or use `toBuffer()` and write manually after ensuring the path exists.
No dependency data recorded yet.