jsReport - 在Excel中生成报告

时间:2016-09-27 10:08:21

标签: jsreport

我尝试使用xlsx配方运行Excel报告: https://playground.jsreport.net/studio/workspace/r1aKmpva/4

当我尝试在本地运行相同的代码时出现以下错误:

    Error occured - Error during rendering report: Cannot read property 'parseString' of null
    Stak - TypeError: Cannot read property 'parseString' of null
        at toRow.ctx.root.$xlsxTemplate.[Content_Types].xml.Types.Default.filter.ctx.root.$xlsxTemplate.(anonymous function).Relationships.Relationship.filter.xml2json (evalmachine.<anonymous>:300:11)
        at toRow.ctx.root.$xlsxTemplate.[Content_Types].xml.Types.Default.filter.ctx.root.$xlsxTemplate.(anonymous function).Relationships.Relationship.filter.xml2jsonUnwrap (evalmachine.<anonymous>:293:18)
        at Object.add (evalmachine.<anonymous>:110:21)
        at Object.<anonymous> (evalmachine.<anonymous>:334:17)
        at Object.eval (eval at createFunctionContext (D:\Projects_CHB\js_report_to_del\node_modules\jsreport\node_modules\jsreport-handlebars\node_modules\handlebars\dist\cjs\handlebars\compiler\javascript-compiler.js:254:23), <anonymous>:5:79)
        at main (D:\Projects_CHB\js_report_to_del\node_modules\jsreport\node_modules\jsreport-handlebars\node_modules\handlebars\dist\cjs\handlebars\runtime.js:173:32)
        at ret (D:\Projects_CHB\js_report_to_del\node_modules\jsreport\node_modules\jsreport-handlebars\node_modules\handlebars\dist\cjs\handlebars\runtime.js:176:12)
        at ret (D:\Projects_CHB\js_report_to_del\node_modules\jsreport\node_modules\jsreport-handlebars\node_modules\handlebars\dist\cjs\handlebars\compiler\compiler.js:525:21)
        at D:\Projects_CHB\js_report_to_del\node_modules\jsreport\node_modules\jsreport-handlebars\lib\handlebarsEngine.js:26:14
        at evalmachine.<anonymous>:1:41
    From previous event:
        at D:\Projects_CHB\js_report_to_del\node_modules\jsreport\node_modules\jsreport-core\lib\render\render.js:143:54
        at _fulfilled (D:\Projects_CHB\js_report_to_del\node_modules\jsreport\node_modules\jsreport-core\node_modules\listener-collection\node_modules\q\q.js:794:54)
        at self.promiseDispatch.done (D:\Projects_CHB\js_report_to_del\node_modules\jsreport\node_modules\jsreport-core\node_modules\listener-collection\node_modules\q\q.js:823:30)
        at Promise.promise.promiseDispatch (D:\Projects_CHB\js_report_to_del\node_modules\jsreport\node_modules\jsreport-core\node_modules\listener-collection\node_modules\q\q.js:756:13)
        at D:\Projects_CHB\js_report_to_del\node_modules\jsreport\node_modules\jsreport-core\node_modules\listener-collection\node_modules\q\q.js:564:44
        at flush (D:\Projects_CHB\js_report_to_del\node_modules\jsreport\node_modules\jsreport-core\node_modules\listener-collection\node_modules\q\q.js:110:17)

我真的不明白我做错了什么。

然后我做npm install jsreport-xlsx来安装配方并得到以下错误:

    Error occured - Error during rendering report: (intermediate value)(intermediate value)(intermediate value)(intermediate value)(intermediate value)(intermediate value)(intermediate value)(intermediate value)(intermediate value)(intermediate value)(intermediate value)(intermediate value)(intermediate value)(...) is not a function
    Stak - TypeError: (intermediate value)(intermediate value)(intermediate value)(intermediate value)(intermediate value)(intermediate value)(intermediate value)(intermediate value)(intermediate value)(intermediate value)(intermediate value)(intermediate value)(intermediate value)(...) is not a function
        at evalmachine.<anonymous>:358:1
        at ContextifyScript.Script.runInNewContext (vm.js:18:15)
        at Object.exports.runInNewContext (vm.js:49:17)
        at module.exports (D:\Projects_CHB\js_report_to_del\node_modules\jsreport\node_modules\jsreport-core\lib\render\engineScript.js:150:10)
        at process.<anonymous> (D:\Projects_CHB\js_report_to_del\node_modules\jsreport\node_modules\jsreport-core\node_modules\script-manager\lib\worker-processes.js:45:38)
        at emitTwo (events.js:87:13)
        at process.emit (events.js:172:7)
        at internal/child_process.js:696:12
    From previous event:
        at D:\Projects_CHB\js_report_to_del\node_modules\jsreport\node_modules\jsreport-core\lib\render\render.js:143:54
        at _fulfilled (D:\Projects_CHB\js_report_to_del\node_modules\jsreport\node_modules\jsreport-core\node_modules\listener-collection\node_modules\q\q.js:794:54)
        at self.promiseDispatch.done (D:\Projects_CHB\js_report_to_del\node_modules\jsreport\node_modules\jsreport-core\node_modules\listener-collection\node_modules\q\q.js:823:30)
        at Promise.promise.promiseDispatch (D:\Projects_CHB\js_report_to_del\node_modules\jsreport\node_modules\jsreport-core\node_modules\listener-collection\node_modules\q\q.js:756:13)
        at D:\Projects_CHB\js_report_to_del\node_modules\jsreport\node_modules\jsreport-core\node_modules\listener-collection\node_modules\q\q.js:564:44
        at flush (D:\Projects_CHB\js_report_to_del\node_modules\jsreport\node_modules\jsreport-core\node_modules\listener-collection\node_modules\q\q.js:110:17)

1 个答案:

答案 0 :(得分:0)

这是使用npm @ 2安装时发生的jsreport错误。 请将npm更新为版本3并重新安装jsreport。

错误参考here