Register custom helper for docx template

  • Hi,

    I would like to use some custom helper in the docx but I cant find the documentation on that. I try to register that in beforeRender script but seems within the docx file it doesnt recognize that.

  • OK I sorted it out. As it is run in worker with another context, need to parse the loading code as string in the req.template.helpers during beforeRender function for the engine to load it inside the context.

    async function beforeRender (req, res) {
      req.template.helpers = `
        const handlebars = require('handlebars');
        const HandlebarsIntl = require('handlebars-intl')
        const helpers = require('handlebars-helpers')({
          handlebars: handlebars

  • Custom helpers can be registered directly in the template through the studio
    There you can register handlebars helper libs

Log in to reply

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.