Hi guys, i have the following example:
var path = require('path');
var fs = require('fs');
var request = require('request');
var jsreport = require('jsreport-core')(
{
"tasks": {
"allowedModules": "*"
}
}
);
jsreport.use(require('jsreport-handlebars')());
jsreport.use(require('jsreport-templates')());
jsreport.use(require('jsreport-xlsx')());
exports.productionExcelPrint = (req, res, next) => {
jsreport.init().then(() => {
return jsreport.render({
template: {
content: fs.readFileSync(path.join(__dirname, 'productionExcel.handlebars')).toString(),
engine: 'handlebars',
recipe: 'xlsx'
}
}).then(function (res) {
res.stream.pipe(fs.createWriteStream('out.xlsx'))
});
}).catch(function (e) {
console.log("error here: ", e)
});
};
and my template "productionExcel.handlebars"
{{#xlsxAdd "xl/worksheets/sheet1.xml" "worksheet.sheetData[0].row"}}
<row>
<c t="inlineStr"><is><t>LOB</t></is></c>
</row>
{{/xlsxAdd}}
{{{xlsxPrint}}}
and im getting this error:
error here: { Error: Unable to parse xlsx template JSON string (maybe you are missing {{{xlsxPrint}}} at the end?):
{"$xlsxTemplate":{"_rels/.rels":"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\r\n<...
at D:\HTML5\JsReport\wwwroot\node_modules\jsreport-xlsx\lib\fallback.js:67:17
at tryCatcher (D:\HTML5\JsReport\wwwroot\node_modules\jsreport-xlsx\node_modules\bluebird\js\release\util.js:16:23)
at Promise._settlePromiseFromHandler (D:\HTML5\JsReport\wwwroot\node_modules\jsreport-xlsx\node_modules\bluebird\js\release\promise.js:512:31)
at Promise._settlePromise (D:\HTML5\JsReport\wwwroot\node_modules\jsreport-xlsx\node_modules\bluebird\js\release\promise.js:569:18)
at Promise._settlePromise0 (D:\HTML5\JsReport\wwwroot\node_modules\jsreport-xlsx\node_modules\bluebird\js\release\promise.js:614:10)
at Promise._settlePromises (D:\HTML5\JsReport\wwwroot\node_modules\jsreport-xlsx\node_modules\bluebird\js\release\promise.js:689:18)
at Async._drainQueue (D:\HTML5\JsReport\wwwroot\node_modules\jsreport-xlsx\node_modules\bluebird\js\release\async.js:133:16)
at Async._drainQueues (D:\HTML5\JsReport\wwwroot\node_modules\jsreport-xlsx\node_modules\bluebird\js\release\async.js:143:10)
at Immediate.Async.drainQueues (D:\HTML5\IJsReport\wwwroot\node_modules\jsreport-xlsx\node_modules\bluebird\js\release\async.js:17:14)
at runCallback (timers.js:789:20)
at tryOnImmediate (timers.js:751:5)
at processImmediate [as _immediateCallback] (timers.js:722:5) weak: true }