Repository navigation
9.15.0 adds new ways to fill in templates and keep their look, and makes the browser bundle smaller. ImagePatch lets patchDocument swap the image of a picture that's already in a template, keeping its size, position, text wrapping and effects, with the placeholder in the picture's alt text (#3072). With trimPlaceholders: true, placeholders typed with spaces inside their braces, such as {{ name }}, are patched too (#3112). readTheme reads the theme of a Word document or template, so a new document's styles keep its fonts and colors, and theme now takes the theme's fonts for other scripts (#878). paragraph.with() makes a new paragraph from an existing one with some of its options changed (#3330). The browser bundle is about 29 KB smaller, as docx now zips with fflate, hashes with its own SHA-1 and SHA-256, and leaves out stream code it doesn't use (#3834). On the fixes side, Word now shows Update Table on a table of contents that docx writes (#2598), and a table with relativeVerticalPosition: INLINE is now written in line with the text, as Word does, rather than floating (#331). Text with control characters that XML 1.0 doesn't allow, such as a vertical tab, no longer makes a document Word can't open, and an image whose alt text has only a description now gets the empty name the XML requires. When Packer.toStream can't zip, as in a browser, the failure now comes on the stream's error event rather than as an unhandled rejection.
What's Changed
- feat: replace the image of a picture in a template, keeping its look, with ImagePatch (#3072) by @dolanmiu in #3828
- build(deps-dev): bump inquirer from 14.2.3 to 14.2.4 by @dependabot[bot] in #3822
- build(deps-dev): bump eslint-plugin-jsdoc from 65.3.12 to 65.3.15 by @dependabot[bot] in #3824
- build(deps-dev): bump @typescript-eslint/parser from 8.71.2 to 8.72.0 by @dependabot[bot] in #3825
- fix: give a drawing whose alt text has no name an empty name, which the XML requires by @dolanmiu in #3829
- feat: patch placeholders with spaces inside their delimiters, such as {{ name }}, with trimPlaceholders (#3112) by @dolanmiu in #3830
- feat: make a new paragraph with other options from a paragraph, with Paragraph's with() (#3330) by @dolanmiu in #3831
- build(deps-dev): bump typescript-eslint from 8.71.2 to 8.72.0 by @dependabot[bot] in #3826
- build(deps): bump fast-uri from 3.1.8 to 3.1.9 in the npm_and_yarn group across 1 directory by @dependabot[bot] in #3832
- fix: show Word's Update Table on a table of contents, by putting it in Word's Table of Contents gallery (#2598) by @dolanmiu in #3833
- docs: pipe Packer.toStream's stream straight away in the quickstart by @dolanmiu in #3835
- perf: make the browser bundle 29 KB smaller, zipping with fflate and hashing with docx's own SHA-1 and SHA-256 (#3834) by @dolanmiu in #3836
- fix: write a table lined up inline down the page in line with the text, as Word floats one with w:tblpYSpec="inline" (#331) by @dolanmiu in #3838
- feat: read the theme of a Word document or template with readTheme, and theme fonts for other scripts (#878) by @dolanmiu in #3839
- perf: avoid unused stream polyfills by @nperez0111 in #3837
- fix: emit toStream's failure to zip on its error event, as in a browser without Buffer, not as an unhandled rejection by @dolanmiu in #3844
- docs: say Packer.toBuffer rejects in a browser, which has no Buffer, rather than giving a Uint8Array by @dolanmiu in #3845
- build(deps-dev): bump vite from 8.3.4 to 8.3.5 by @dependabot[bot] in #3841
- build(deps-dev): bump execa from 10.2.0 to 10.2.1 by @dependabot[bot] in #3842
- build(deps-dev): bump eslint-plugin-jsdoc from 65.3.15 to 65.4.2 by @dependabot[bot] in #3843
- fix: leave out the control characters that XML 1.0 does not allow by @wleeaf in #3840
- chore: add a release skill by @dolanmiu in #3847
- chore: Version bump to 9.15.0 by @dolanmiu in #3846
- chore: add the documentation-writer skill by @dolanmiu in #3848
- build(deps-dev): bump eslint-plugin-unicorn from 78.0.0 to 79.0.0 by @dependabot[bot] in #3849
New Contributors
- @nperez0111 made their first contribution in #3837
- @wleeaf made their first contribution in #3840
Full Changelog: 9.14.0...9.15.0