Skip to content

5.0.0-rc5

Compare
Choose a tag to compare
@dolanmiu dolanmiu released this 08 Aug 01:01
· 2494 commits to master since this release

#373
#371
#336
#337
#340
#341

Major breaking changes

Declaritive API

It was a tough decision, but a lot of thought was put into it. Now the Paragraph API is more declaritive. Method chaining is now slowly being deprecated.

You can read more of why method chaining is bad here:
https://stackoverflow.com/questions/1103985/method-chaining-why-is-it-a-good-practice-or-not
https://softwareengineering.stackexchange.com/a/266585/249600

From this:

image

To this:

image

The reason for this is that, the code will not give a compile error if you do:

new Paragraph(text).heading1().heading2()

...but instead, it will break the Word document itself. This is clearly a design flaw and allows for potential bugs and issues.

Sections

Now at least one section is required per document. Check the demo folder for examples, and here for the documentation: https://docx.js.org/#/usage/sections

Static Packer

Packer is now static: #373