About this project

docx is an open-source JavaScript/TypeScript library for creating and modifying .docx (Microsoft Word) documents. Its README presents a declarative API: you describe document structure with objects such as Document, Paragraph, Header and Table, and the library produces a .docx file. It is stated to work both in Node and in the browser. Documentation and examples live at docx.js.org, and the repository includes a demo folder. The README links to browser demos on CodePen and JSFiddle, framework examples for Angular, React and Vue.js on StackBlitz, and Node examples on RunKit covering simple and advanced paragraphs, bullet points, tables, images, margins, landscape orientation, and headers and footers. One example is described as a CV generated with docx. Beyond the core package, the README documents optional entry points: docx/shapes for shapes, groups of shapes and diagrams with connectors; docx/watermarks for watermarks; and docx/charts for native Word charts. These are kept out of the main package so documents that do not use them do not carry their code. A code sample shows importing ChartRun, ShapeRun and TextWatermark and using them inside a Document with sections, headers and paragraphs. For pages without a bundler, the README says to load dist/shapes.umd.cjs, dist/watermarks.umd.cjs or dist/charts.umd.cjs after dist/index.umd.cjs, which add the docxShapes, docxWatermarks and docxCharts globals. The README also points to Docx.js Editor, an interactive playground for coding and previewing results in real time, and to contribution guidelines. It lists a number of companies and products as users of the library, and includes badges for npm version, monthly downloads, GitHub Actions workflow status, known vulnerabilities, pull-request welcome status and code coverage. The project is distributed via npm under the package name docx.