Releases: guigrpa/docx-templates
Releases · guigrpa/docx-templates
v4.6.1
- 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 anINS
command is an Object. This ensures you don't accidentally put'[object Object]'
in your report.
v4.6.0
v4.5.4
v4.5.3
v4.5.2
v4.5.1
v4.5.0
- 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 setfixSmartQuotes
to 'true', these smart quotes will automatically get replaced with straight quotes (') before command evaluation. Defaults to false.
v4.4.0
- 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
v4.2.0
- Feature: added 'rejectNullish' setting. When set to
true
, this setting ensurescreateReport
throws aNullishCommandResultError
when the result of an INS, HTML, IMAGE, or LINK command isnull
orundefined
. This is useful as nullish return values usually indicate a mistake in the template or the invoking code. Defaults tofalse
. - Enhancement: typed Errors to facilitate more fine-grained downstream error handling.