Skip to content

Releases: guigrpa/docx-templates

v4.6.1

01 Jun 15:53
Compare
Choose a tag to compare
  • Fix for issue #213: throw an error when user tries to iterate over a non-array in a template with a FOR loop. This used to create an infinite loop.
  • Throw ObjectCommandResultError when the result of an INS command is an Object. This ensures you don't accidentally put '[object Object]' in your report.

v4.6.0

27 Mar 15:11
Compare
Choose a tag to compare
  • Add support for .docm (macro-enabled) templates (issue #195). Thanks @brockfanning!

v4.5.4

05 Mar 10:10
Compare
Choose a tag to compare
  • Improve error messages.
  • Export error types at the library level.
  • Update dependencies.

v4.5.3

18 Dec 12:06
Compare
Choose a tag to compare
  • Correctly export getMetadata function from library index module / entrypoint.

v4.5.2

13 Nov 18:19
Compare
Choose a tag to compare
  • Corrected check for valid image data. ArrayBuffers are now also valid image data containers, as the type definitions suggest (issue #166).

v4.5.1

24 Oct 11:55
Compare
Choose a tag to compare
  • Enhancement: extensive validation of IMAGE command parameters before execution to prevent silent failures caused by user error, particularly in plain javascript and untyped settings. Related to issue #158.

v4.5.0

16 Sep 12:43
Compare
Choose a tag to compare
  • Feature: added fixSmartQuotes flag (see PR #152). Thanks @speedpro! MS Word usually autocorrects JS string literal quotes with unicode 'smart' quotes ('curly' quotes). E.g. 'aubergine' -> ‘aubergine’. This causes an error when evaluating commands containing these smart quotes, as they are not valid JavaScript. If you set fixSmartQuotes to 'true', these smart quotes will automatically get replaced with straight quotes (') before command evaluation. Defaults to false.

v4.4.0

19 Aug 10:30
Compare
Choose a tag to compare
  • Feature: added getMetadata function to extract the metadata fields from a document, such as the number of pages or words (see issue #94).
  • Feature: user can now provide a custom errorHandler callback to handle any errors that may occur when executing commands from a template. The value returned by this callback will be inserted into the rendered document instead (see issue #138).
  • Restructured CommandExecutionError to make it contain the full Error original object that caused it to be thrown.

v4.3.0

23 Jun 12:12
Compare
Choose a tag to compare
  • Feature: added listCommands function to find and list all commands in a document (see issue #90).
  • Minor refactoring.
  • Updated jszip dependency.

v4.2.0

15 Jun 14:08
Compare
Choose a tag to compare
  • Feature: added 'rejectNullish' setting. When set to true, this setting ensures createReport throws a NullishCommandResultError when the result of an INS, HTML, IMAGE, or LINK command is null or undefined. This is useful as nullish return values usually indicate a mistake in the template or the invoking code. Defaults to false.
  • Enhancement: typed Errors to facilitate more fine-grained downstream error handling.