Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function getDocxReportFromJSON(json, template) {
let zip = new JSZip(templates[template]);
let doc = new Docxtemplater();
doc.loadZip(zip);
//set the templateVariables
doc.setData(json);
try {
// render the document (replace all occurences of tags.
doc.render()
} catch (error) {
let e = {
message: error.message,
name: error.name,
stack: error.stack,
properties: error.properties
}