xlsxAddImage error when run under local server

  • I just run jsreport under my local server, and try to add an image to existed xslx template. error happened,but online version(https://playground.jsreport.net/studio/workspace/Hk2B9bcif/3) is OK, anyone can help me?:

    Error occured - Error during rendering report: Cannot read property 'r:id' of undefined
    Stak - evalmachine.<anonymous>:249
          var rid = this.ctx.root.$xlsxTemplate['xl/worksheets/' + sheetFullName].worksheet.drawing.$['r:id']
    TypeError: Cannot read property 'r:id' of undefined
        at Object.ensureDrawingOnSheet (evalmachine.<anonymous>:249:98)
        at Object.addImage (evalmachine.<anonymous>:324:48)
        at Object.<anonymous> (evalmachine.<anonymous>:408:17)
        at Object.eval [as main] (eval at createFunctionContext (C:\Users\user\Desktop\xiaolin.niu\doc-generater\node_modules\handlebars\dist\cjs\handlebars\compiler\javascript-compiler.js:255:23), <anonymous>:5:89)
        at main (C:\Users\user\Desktop\xiaolin.niu\doc-generater\node_modules\handlebars\dist\cjs\handlebars\runtime.js:173:32)
        at ret (C:\Users\user\Desktop\xiaolin.niu\doc-generater\node_modules\handlebars\dist\cjs\handlebars\runtime.js:176:12)
        at ret (C:\Users\user\Desktop\xiaolin.niu\doc-generater\node_modules\handlebars\dist\cjs\handlebars\compiler\compiler.js:525:21)
        at C:\Users\user\Desktop\xiaolin.niu\doc-generater\node_modules\jsreport-handlebars\lib\handlebarsEngine.js:25:14
        at evalmachine.<anonymous>:1:41
        at ContextifyScript.Script.runInContext (vm.js:59:29)

  • The line where the it crashes is here

    It seems that your xlsx template has unexpected xml node drawing in the xl/worksheets/sheet1.xml.
    What jsreport version do you use? I would try to replicate it.
    Is the xlsx template uploaded to the playground really the same?

  • I just used jsreport 1.10.0 version. And I fixed that by add this line code in file: jsreport-xlsx /helper.js :247 :
    this.ctx.root.$xlsxTemplate['xl/worksheets/' + sheetFullName].worksheet.drawing=this.ctx.root.$xlsxTemplate['xl/worksheets/' + sheetFullName].worksheet.drawing[0];

  • It seems like the drawing is Array, but the program try to regard as Object.

  • Thank you.
    I've add to the back log task to make it working also when the drawing is an array.

Log in to reply

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