Error about creating Excel reports
-
Hi @jan_blaha ,
I do not know what happened - but all the Excel reports suddenly did not work on my computer.
Here is an error example:
The exact same report is working on another machine:
All PDF reports are working fine.
Do you have any suggestions that I can follow to debug the issue?
Thank you,
Genhan
-
Didn't you update to the node 16?
You need to use the node 14 in jsreport v2 to have office recipes working.
Downgrade node or upgrade jsreport to v3.
-
Thank you, @jan_blaha. I am using Node 16.
After upgrading jsReport to version 3.1.1, a new error occurred:
Here is the full error message:
Error when evaluating engine handlebars for template /templates/PublicPrjs_Maps Cannot read properties of undefined (reading '1') (sandbox.js) 150 | const obj = ctx.root.$xlsxTemplate[filePath] 151 | const collection = evalGet(obj, path) > 152 | ctx.root.$removedItem = collection[index] | ^ 153 | collection.splice(index, 1) 154 | return '' 155 | } (sandbox.js) 462 | } 463 | > 464 | return fn.apply(this, arguments) | ^ 465 | } 466 | } 467 | (sandbox.js) 489 | } 490 | function xlsxRemove (...args) { > 491 | return __xlsx.xlsxRemove.call(this, ...args) | ^ 492 | } 493 | function xlsxAddImage (...args) { 494 | return __xlsx.xlsxAddImage.call(this, ...args) TypeError: Cannot read properties of undefined (reading '1') at Proxy.remove (sandbox.js:152:39) at Proxy.<anonymous> (sandbox.js:464:17) at Proxy.xlsxRemove (sandbox.js:491:28) at Object.base.apply (C:\CPMS\iroot-new\cpms-reporting\node_modules\vm2\lib/contextify.js:246:34) at Object.<anonymous> (C:\CPMS\iroot-new\cpms-reporting\node_modules\@jsreport\jsreport-core\lib\worker\render\executeEngine.js:195:27) at Object.wrapper (C:\CPMS\iroot-new\cpms-reporting\node_modules\handlebars\dist\cjs\handlebars\internal\wrapHelper.js:15:19) at Object.main (eval at compile (C:\CPMS\iroot-new\cpms-reporting\node_modules\@jsreport\jsreport-handlebars\lib\handlebarsEngine.js:34:30), <anonymous>:71:113) at main (C:\CPMS\iroot-new\cpms-reporting\node_modules\handlebars\dist\cjs\handlebars\runtime.js:208:32) at ret (C:\CPMS\iroot-new\cpms-reporting\node_modules\handlebars\dist\cjs\handlebars\runtime.js:212:12) at Object.execute (C:\CPMS\iroot-new\cpms-reporting\node_modules\@jsreport\jsreport-handlebars\lib\handlebarsEngine.js:66:20)
Any other updates shall I do?
Many thanks,
Genhan
-
Better to downgrade the node. It will be a more seamless fix.
Regarding v3 update problem, are you able to replicate this in playground?
-
I looked more at the detail, and it seems that your template has lost the reference to the "xlsx template".
The v3 during the startup process automatically migration and converts the old xlsxTemplate entities to assets.
https://jsreport.net/learn/v3-migration-guide#xlsxtemplates
Maybe there was some error during this. You should be able to manually edit the template and add the xlsx template reference.It would be great if you email me your original v2 data in export. I would love to take a look at why the migration didn't process it correctly.
-
Hi @jan_blaha,
Downgrading Node to 14 resolved this issue, but we do need to update them in the near future
I will try your suggestion about linking xlsx templates manually. I think that it might resolve the issue - since I tried the same report in the playground and it works: https://playground.jsreport.net/w/anon/8iI_gl82 .
Sure. Where should I drop the original v2 data?
Thank you,
Genhan
-
Hi @jan_blaha ,
I upgraded to v3 again and captured the v3 template folder structure in the following screenshot:
The v2 structure in the xlsxTemplates folder is like:
Those
***.xlsx
folders were created by the migration process.Thank you,
Genhan
-
Hi @jan_blaha , do you have a guide about how to add the xlsx template reference manually? I copied xlsx templates (e.g. PublicPrjXlsxTpl) into the
assets
folder manually - but it did not work.
-
The reference to the excel template is set in the template properties.
If it's possible, please send me the v2 data to jan.blaha@jsreport.net
-
Thank you, @jan_blaha. I emailed you the v2 data zip. Let me know if you received it.
Best,
Genhan
-
I apologize for the delay. I found the email but the attachment was removed by some email servers on the way.
Could you please zip the attachment and send it again to these two email addresses? Thank you
-
@jan_blaha , I shared the zipped data folder in Dropbox with you. Let me know if you received the share link.
Thank you,
Genhan
-
Thank you, I received your data.
I analyzed the migration of data there and it looks fine.
The problem is that the data already includes a flag that data were migrated so it doesn't run again.
Please remove filedata/settings
and start jsreport v3 again. It should migrate properly the xlsx templates to assets and fill the references for you.
-
Thank you so much, @jan_blaha! Removing
data/setting
resolved the issue.