Change in file type after importing xlsx file



  • I migrated jsreport version from v2 to v3. Handlebar files are migrated to html, but when I import xlsx template, content type changed from .html to .xlsx. I am not able to preview template after importing.



  • I am not sure what's the problem from this description, but...

    The migration process is like this.

    You have v2 application with the data.
    change the jsreport version in the package.json
    npm install
    start jsreport

    The first run will do the required data migrations.
    The later import of templates from the older versions won't work properly.

    If you have the app that already started with the updated version and wants to run the data migration again, you need to remove file data/settings and start again.

    Don't forget to properly backup data before updating.



  • I created blank excel sheet and imported, I am able to put the data in xlsx template. But If I use old template it is not working. Is there any way to migrate old xlsx template as it contains more data and it is very complex to create new template similar to old one. Can you please help?

    Thank You.



  • Please try to elaborate more... There are many terms you use that have multiple meanings. Please describe exactly what you do, share screens and full errors.



  • Hi, previously I was having v2 of jsreport and this was working fine. Now I have migrated jsreport to v3. When I am trying to run now, its giving me this below error,

    Error while executing xlsx recipe
    (because) error when evaluating engine handlebars for template anonymous
    (because) parse error on line 11:
    ...iginalFormula=''Raw Data'!B2'}}</f><v>0<
    -----------------------^
    Expecting 'EQUALS', got 'INVALID'
    (sandbox.js line 124:18).

    The error is coming because in Raw Data (sheet) data is not getting populated.
    I tried one thing, created new excel sheet and uploaded it, this time data got populated in the sheet. But this was just test xlsx file.
    The v2 xlsx template is bit complex and creating new one similar to it is difficult so I want to use v2 xlsx template only and populate data. Can you please help me in this as I am stuck here.

    Thank you!!



  • So this is a duplicate of https://forum.jsreport.net/topic/3029/error-while-generating-xlsx-report ?

    Now it seems its rather a regression issue in v3 then a data migration problem.
    I will need a minimal playgroud demo replicating the issue so I can verify it.




  • administrators

    thanks for the playground demo, i have found the issue and this is fixed now in master, will be released as soon we accumulate more changes



  • Thanks a lot @bjrmatos. When can I expect release?



  • I used the code you have pushed to master, previous error is resolved. But now I am facing below issue

    Invalid character in entity name
    Line: 1
    Column: 4873
    Char:
    Error: Invalid character in entity name
    Line: 1
    Column: 4873
    Char:
    at error (/home/js-report/node_modules/xml2js-preserve-spaces/node_modules/sax/lib/sax.js:651:10)
    at strictFail (/home/js-report/node_modules/xml2js-preserve-spaces/node_modules/sax/lib/sax.js:677:7)
    at SAXParser.write (/home/js-report/node_modules/xml2js-preserve-spaces/node_modules/sax/lib/sax.js:1491:13)


  • administrators

    is this something i can replicate with the same playground demo? with the same template the render completed correctly after i fixed the change, if somehow the demo is different now let me know or update the playground so i can test and check what can be wrong



  • The problem in the original file was executing formulas. During debugging I found many xml chunks throwing error. In each chunk I removed the formula mentioned in the last cell. In the below example(N17). After those changes I was able to render template.

    Example xml chunk:
    <calcChain xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><c r="B12" i="5" l="1"/><c r="B11" i="5"/><c r="B10" i="5"/><c r="B9" i="5"/><c r="B8" i="5"/><c r="B7" i="5"/><c r="B6" i="5"/><c r="B5" i="5"/><c r="B4" i="5"/><c r="B3" i="5"/><c r="B2" i="5"/><c r="B1" i="5"/><c r="M21" i="1"/><c r="L21" i="1"/><c r="M20" i="1"/><c r="L20" i="1"/><c r="M19" i="1"/><c r="L19" i="1"/><c r="E19" i="1"/><c r="D19" i="1"/><c r="M18" i="1"/><c r="L18" i="1"/><c r="E18" i="1"/><c r="D18" i="1"/><c r="M17" i="1"/><c r="L17" i="1"/><c r="E17" i="1"/><c r="D17" i="1"/><c r="F17" i="1" s="1"/><c r="E16" i="1"/><c r="D16" i="1"/><c r="F16" i="1" s="1"/><c r="E15" i="1"/><c r="D15" i="1"/><c r="F15" i="1" s="1"/><c r="M14" i="1"/><c r="L14" i="1"/><c r="N14" i="1" s="1"/><c r="E14" i="1"/><c r="D14" i="1"/><c r="M13" i="1"/><c r="L13" i="1"/><c r="E13" i="1"/><c r="D13" i="1"/><c r="M12" i="1"/><c r="L12" i="1"/><c r="E12" i="1"/><c r="D12" i="1"/><c r="M11" i="1"/><c r="L11" i="1"/><c r="E11" i="1"/><c r="D11" i="1"/><c r="F11" i="1" s="1"/><c r="M10" i="1"/><c r="L10" i="1"/><c r="E10" i="1"/><c r="D10" i="1"/><c r="M9" i="1"/><c r="L9" i="1"/><c r="L15" i="1" s="1"/><c r="E9" i="1"/><c r="D9" i="1"/><c r="E8" i="1"/><c r="E23" i="1" s="1"/><c r="D8" i="1"/><c r="C4" i="1"/><c r="D23" i="1" l="1"/><c r="F9" i="1"/><c r="N9" i="1"/><c r="F10" i="1"/><c r="N10" i="1"/><c r="N11" i="1"/><c r="F12" i="1"/><c r="N12" i="1"/><c r="F13" i="1"/><c r="N13" i="1"/><c r="F14" i="1"/><c r="F18" i="1"/><c r="N18" i="1"/><c r="F19" i="1"/><c r="N19" i="1"/><c r="N20" i="1"/><c r="L22" i="1"/><c r="N21" i="1"/><c r="F6" i="1"/><c r="L23" i="1"/><c r="N6" i="1" s="1"/><c r="F8" i="1"/><c r="N17" i="1"/></calcChain>

    I tried to replicate the same issue but I am not able to perform B5=SUM(B2:B4). I have updated xlsx template. Please check.

    Thank you!!


  • administrators

    The problem in the original file was executing formulas

    yes, this seems to be working after the fix i pushed the last time.

    I tried to replicate the same issue but I am not able to perform B5=SUM(B2:B4). I have updated xlsx template. Please check.

    i don't see more issues in the playground demo, i guess what you want now is to make the formulas in the Sheet1 to work, it is not throwing error now but i see the formula is defined but not producing the correct output in MS Excel (it just shows 0 as result). the reason for it to produce 0 is because you are not generating the cells with the correct number type, so when the formulas trying to do sum of cells it just find string, and when SUM is used with string it just returns 0.

    you should fix the part of your xlsx transformation code to generate cells with the number type, if you have trouble with that, then just use the xlsx generation process which is designed to avoid getting into xml details about generating cells.


Log in to reply
 

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