unstale

npm / docx

docx

What changed in docx 8 to 9, from its official release notes, upgrade guides and advisories. Sources checked 2026-11-28.

14 breaking1 deprecations74 new APIs and options2 performance13 behavior and defaults1 tooling52 fixes and other

See which of these apply to your code, ranked, in your agent:

npx @unstale/cli init

@unstale/cli on npm

docx 9148 changes

Breaking changes 12

  • No longer wraps its XML in an <undefined> element.

    9.15.1release notes

  • When zipping fails, toStream emits the failure on the stream's error event instead of causing an unhandled rejection.

    9.15.0release notes

  • A table with relativeVerticalPosition set to INLINE is now written in line with the text rather than floating.

    9.15.0release notes

  • The package now declares that Node.js 16 or later is required.

    9.14.0release notes

  • Table rows with no cells are omitted because Word can't open them.

    9.13.0release notes

  • A paragraph or table no longer type-checks as a paragraph's child.

    9.13.0release notes

  • Throws when a drawing is too large for Word to open.

    9.9.0release notes

  • Removes the empty WORKAROUND2 export, which was only needed by awesome-typescript-loader.

    9.8.1release notes

  • Removes the empty WORKAROUND3 export, which was only needed by awesome-typescript-loader.

    9.8.1release notes

  • Removes the empty WORKAROUND4 export, which was only needed by awesome-typescript-loader.

    9.8.1release notes

  • External styles are now merged with default styles, affecting generated document styling.

    9.5.3release notes

  • The list of supported highlight colors is now limited.

    9.0.0release notes

New APIs and options 70

  • Can now be set in paragraph styles, numbering levels, and document defaults, in addition to on a paragraph.

    9.16.0release notes

  • Adds a paragraph option for controlling the small space Word puts between East Asian text and an adjacent Latin letter.

    9.16.0release notes

  • Use ImagePatch with patchDocument to replace a picture's image in a template while keeping its size, position, text wrapping, and effects.

    9.15.0release notes

  • Read the theme of a Word document or template so a new document's styles can keep its fonts and colors.

    9.15.0release notes

  • Set trimPlaceholders to true to patch placeholders with spaces inside their braces, such as {{ name }}.

    9.15.0release notes

  • Use paragraph.with() to create a new paragraph from an existing one with some options changed.

    9.15.0release notes

  • Adds a diagonal-down border to table cells, allowing a header cell to be split.

    9.14.0release notes

  • Adds a diagonal-up border to table cells, allowing a header cell to be split.

    9.14.0release notes

  • Adds an entry for citing sources and listing them in a bibliography using Word's citation styles.

    9.14.0release notes

  • Adds an entry for embedding files as objects that open when double-clicked.

    9.14.0release notes

  • Marks the end of a part of a protected document that remains editable.

    9.14.0release notes

  • Marks the start of a part of a protected document that remains editable.

    9.14.0release notes

  • Embeds a file, such as a spreadsheet, as an object that opens when double-clicked.

    9.14.0release notes

  • Fits a run's text to a width.

    9.14.0release notes

  • Can set document properties, such as its title and author, when patching a document.

    9.14.0release notes

  • Makes a document read-only in Word or keeps parts editable, with an optional password.

    9.14.0release notes

  • Styles a section's line numbers.

    9.14.0release notes

  • Lets you choose what fills the space before table-of-contents page numbers, such as nothing or hyphens.

    9.14.0release notes

  • Create macro-enabled .docm documents with VBA code; the new docx/macros entry and a Word-saved vbaProject.bin are also supported.

    9.13.0release notes

  • Runs can use Word's Two Lines in One and Horizontal in Vertical through eastAsianLayout.

    9.13.0release notes

  • Restart a numbered paragraph's list with numbering: { restart: true }, without making up instance numbers.

    9.13.0release notes

  • patchDocument can now read a template from a stream.

    9.13.0release notes

  • Can receive note content directly instead of an identifier, adding the note to the document automatically.

    9.11.0release notes

  • Returns paragraphs and tables from HTML for use in sections and multiple document content locations.

    9.11.0release notes

  • Converts HTML into a paragraph's content for use in paragraphs and paragraph patches.

    9.11.0release notes

  • A paragraph numbering reference can now provide its own definition, which is added when the paragraph is written.

    9.11.0release notes

  • Accepts a numbering option so numbered and bulleted paragraphs in patches work correctly.

    9.11.0release notes

  • Adds document layout calculation matching Word, including page numbers, references, fields, and page contents.

    9.9.0release notes

  • Adds support for footnotes and endnotes in document patching.

    9.9.0release notes

  • Repeats template table rows for each row of supplied data.

    9.9.0release notes

  • Adds footnote and endnote properties to section options.

    9.9.0release notes

  • Adds a locked option to SimpleField.

    9.9.0release notes

  • Converts LaTeX math into editable Word equations, including common commands and environments, and returns components for mixing with hand-built math.

    9.8.1release notes

  • Adds fraction type selection for stacked, skewed, linear or barless fractions.

    9.8.1release notes

  • Adds control over whether integral limits are used.

    9.8.1release notes

  • Adds a component for constructing large mathematical operators used by LaTeX conversion and hand-built equations.

    9.8.1release notes

  • Adds literal handling to MathRun for representing literal mathematical content.

    9.8.1release notes

  • Adds script support to MathRun for constructing scripted mathematical text.

    9.8.1release notes

  • Adds style support to MathRun for controlling the presentation of mathematical text.

    9.8.1release notes

  • Adds control over whether summation limits are used.

    9.8.1release notes

  • Adds new data to charts created and styled in Word while preserving their appearance.

    9.8.0release notes

  • Adds a chart run that can be inserted where a document placeholder is located.

    9.8.0release notes

  • Adds native Word charts with many chart types, including combo, radar, bubble, stock, pie-of-pie, and bar-of-pie charts.

    9.8.0release notes

  • Adds matrices, cases, numbered aligned equations, and brackets made from arbitrary characters while preserving existing math imports.

    9.8.0release notes

  • Adds preset and custom SVG-path shapes, including diagrams, connectors, canvases, automatic layout, and richer text and fill options.

    9.8.0release notes

  • Adds text or picture watermarks behind every page, recognized by Word's Design > Watermark menu.

    9.8.0release notes

  • Images can now be cropped when generating documents.

    9.8.0release notes

  • ImageRun now supports run properties.

    9.8.0release notes

  • Adds drawing canvases with connectors and automatic layout for flowcharts, org charts, and swimlane diagrams.

    9.8.0release notes

  • Adds grouped shapes for composing multiple shapes as a unit.

    9.8.0release notes

  • Adds runs for inserting shapes into documents.

    9.8.0release notes

  • Documents now have a theme, configurable through the theme option for colors and fonts used across document elements.

    9.8.0release notes

  • Generated documents now emit word/commentsIds.xml with durable comment IDs using w16cid.

    9.7.2release notes

  • Comments now support replies.

    9.7.0release notes

  • Paragraph indentation now supports firstLineChars.

    9.7.0release notes

  • Numbering levels can now associate with a paragraph style.

    9.7.0release notes

  • Comments now support a resolved state.

    9.7.0release notes

  • Images now support tracked changes in generated documents.

    9.7.0release notes

  • Table look support was added for conditional table formatting.

    9.6.0release notes

  • The docx library now supports creating endnotes.

    9.6.0release notes

  • Track changes support has been extended with additional functionality.

    9.6.0release notes

  • Support was added for WPS text boxes.

    9.6.0release notes

  • Content Controls are now supported, enabling developers to use them in generated DOCX documents.

    9.5.2release notes

  • Paragraphs now support between borders, allowing developers to configure this border style.

    9.5.2release notes

  • FileChild is now exported for developers to use.

    9.0.0release notes

  • A math limit component is now available.

    9.0.0release notes

  • Documents can now be exported with multiple patches.

    9.0.0release notes

  • Numbering inherited from a paragraph style can now be disabled.

    9.0.0release notes

  • Patches present in a file can now be detected.

    9.0.0release notes

  • SVG images are now supported in documents.

    9.0.0release notes

Performance 2

  • Patching large documents now searches for placeholders in linear time, avoiding quadratic slowdowns while preserving paragraph order.

    9.15.3release notes

  • The browser bundle is about 29 KB smaller after switching zipping and hashing implementations and leaving out unused stream code.

    9.15.0release notes

Behavior and default changes 11

  • The theme now takes the theme's fonts for other scripts.

    9.15.0release notes

  • Cells added below a rowSpan cell now take its formatting and paragraph alignment.

    9.13.0release notes

  • A table's style can now supply its borders.

    9.12.0release notes

  • Bold and italic faces of a font are now embedded in generated documents.

    9.10.0release notes

  • Writes cell widths from columnWidths and applies Word's default cell margins for matching layout.

    9.9.0release notes

  • Can insert ChartRun instances into placeholders and resolve theme colors from a template's own theme.

    9.8.0release notes

  • Text can use the theme's heading or body font, allowing typography to change when the Word theme changes.

    9.8.0release notes

  • Table of Contents creation now supports cached data.

    9.6.0release notes

  • Footnotes now support lists and images.

    9.6.0release notes

  • Table of Contents creation has been extended with additional capabilities.

    9.6.0release notes

  • The system now returns which token has not been found, making missing-token errors more actionable.

    9.5.3release notes

Tooling 1

  • Documentation examples now run with this version, render documents beside editable code, provide completions and type errors, and allow .docx downloads.

    9.8.1release notes

Fixes and other changes 52

  • Now lays out repeated table properties, split rows with multiple line spacing, and overfull fixed-size text boxes as Word does.

    9.16.0release notes

  • The bundled HTML parser is updated to parse5 8.1.1, so docx/html reads HTML with the latest parse5 fixes.

    9.15.4release notes

  • Published types no longer add a global declaration for import.meta.glob, preventing duplicate identifier errors in projects that declare it themselves.

    9.15.2release notes

  • Images are written to the package as image1.png, image2.jpg, and so on instead of using a hash of their data, avoiding empty boxes in Word for the web.

    9.15.1release notes

  • Finds placeholders in link text, content controls, and text typed with Track Changes on, which were previously skipped without an error.

    9.15.1release notes

  • A text box of auto height is written 1in tall so WPS Office fits it to its text.

    9.15.1release notes

  • An image whose alt text has only a description now gets the empty name required by XML.

    9.15.0release notes

  • Word now shows Update Table on a table of contents written by docx.

    9.15.0release notes

  • Control characters disallowed by XML 1.0 are left out so they no longer produce documents Word can't open.

    9.15.0release notes

  • Using style: "Caption" now gives captions Word's Caption style.

    9.14.0release notes

  • Writes a half-inch default tab stop so tabs and list text line up in Pages.

    9.14.0release notes

  • Defines the TOC1 to TOC9 styles so LibreOffice keeps table-of-contents levels indented after updating the table.

    9.14.0release notes

  • Components made by another copy of docx, such as one bundled with a plugin, are written correctly.

    9.13.0release notes

  • Empty alt text is left out of wp:docPr so Word 2007 opens images.

    9.13.0release notes

  • An image's type is read from its data when it isn't provided.

    9.13.0release notes

  • An index entry field no longer scrambles the document in Word.

    9.13.0release notes

  • When page numbers come from docx/layout, a numbered heading's table of contents entry starts with its number.

    9.13.0release notes

  • A style's basedOn is omitted when it is the style's own id.

    9.12.0release notes

  • Rows below a merged cell are sized using the cell's margins.

    9.12.0release notes

  • Restart every level of a numbering instance, not only the first.

    9.12.0release notes

  • Each part of a page number field is written in its own run so it keeps the run's font.

    9.12.0release notes

  • Merged rows are kept together using TableRow keepNext.

    9.12.0release notes

  • Assigns unique drawing identifiers to inserted images so patched documents remain readable by Word.

    9.11.0release notes

  • Adds or reuses heading styles in templates so patched headings retain their intended formatting.

    9.11.0release notes

  • Writes specVanish from its own option instead of incorrectly deriving it from vanish.

    9.11.0release notes

  • External hyperlink fragments are now preserved in Word documents.

    9.10.0release notes

  • Supports writing a bookmark inside another bookmark.

    9.9.0release notes

  • Preserves embedded fonts when saving a document again.

    9.9.0release notes

  • Writes images and lists contained in endnotes.

    9.9.0release notes

  • Preserves paragraph and character styles supplied through externalStyles.

    9.9.0release notes

  • Makes frame width and height optional.

    9.9.0release notes

  • Calls super() once so ImageRun works under Turbopack.

    9.9.0release notes

  • Packing a document again now writes the same document.

    9.9.0release notes

  • Adds the separate field character to page references.

    9.9.0release notes

  • Inserts an inline bookmark with an identifier unused by the template.

    9.9.0release notes

  • Formats patched link text like its placeholder and adds relationships only where used.

    9.9.0release notes

  • Writes table-of-contents entries from document headings.

    9.9.0release notes

  • Bookmark numeric IDs are now allocated per document.

    9.8.0release notes

  • A comments part is written only when the document contains comments.

    9.8.0release notes

  • Style definitions no longer emit an implicit ListParagraph paragraph style.

    9.8.0release notes

  • Normal is now written as the default paragraph style so Pages draws math at its intended size.

    9.8.0release notes

  • Repeated document placeholders are now patched in reverse order.

    9.8.0release notes

  • Theme colors can be used for text, underlines, borders, shading, shapes, and page backgrounds.

    9.8.0release notes

  • Fixed an issue with bundling types, which may affect TypeScript consumers.

    9.7.1release notes

  • Embedded fonts now use sequential filenames.

    9.7.0release notes

  • Page size now correctly sets its code.

    9.7.0release notes

  • Passes the characterSet parameter to createRegularFont when generating font tables.

    9.6.1release notes

  • First-level numbering now allows zero as the starting number.

    9.6.0release notes

  • Multiple splits within a single run are now handled correctly.

    9.6.0release notes

  • XML is pre-encoded as UTF-8 to prevent surrogate pair corruption in JSZip.

    9.6.0release notes

  • Numbered item references are now exported, making that reference available to developers.

    9.5.2release notes

  • Corrects the limit location value of MathIntergral.

    9.0.0release notes

docx 89 changes

Breaking changes 2

Deprecations 1

New APIs and options 4

Behavior and default changes 2

  • Spacing of East Asian text and numbers is automatically adjusted.

    8.0.0release notes

  • Hyperlinks now work on images.

    8.0.0release notes