XLSX odd error



  • Hi,

    I have jsreport running locally - 3.10.0
    My test server is also 3.10.0

    My deployment method is to export a .zip from my local and then do a "Full" import to the test server.

    I have been working on an xlsx file - on my local it will generate like it is supposed to:

    0_1685950713348_Screenshot 2023-06-05 at 5.37.27 pm.png

    But the exact same file, after an import will not work on the test server:

    0_1685950993311_Screenshot 2023-06-05 at 5.39.41 pm.png

    Your help would be appreciated



  • Seems like there is typo in this line, but not sure if that is the actual problem.

    {#asset style.xml}}
    

    Would you be able to email me that export so I can try If I get the same problem?



  • Hi Jan,

    Yes, I have to include that typo - the style file will not apply unless it is types exactly like that - can you tell me how what the exact syntax should be?

    The issue is that the exact same file will work on one environment but not the other - even with that typo, also, I can't send you the export for commercial reasons. But even if I did, you could get the same issue, that it will work locally but not when you upload it to another server.



  • Regarding the typo...

    This does seem to be a problem. I have one report that uses it and runs perfectly:

    This one will run every time:

    0_1686012996651_Screenshot 2023-06-06 at 10.55.59 am.png

    But this one will not:

    0_1686013079740_Screenshot 2023-06-06 at 10.57.28 am.png

    Unless you remove that replace code:

    0_1686013133924_Screenshot 2023-06-06 at 10.58.34 am.png

    But then the files need to be "repaired" because they are not styled properly and are not suitable for client use.

    The exact syntax for that replace code I got from here:

    https://stackoverflow.com/questions/60283656/jsreport-handlebars-engine-and-xlsx-recipe-how-to-fill-cell-with-color

    0_1686013311754_Screenshot 2023-06-06 at 11.01.32 am.png

    I thought it was a typo but it turns out that the stackoverflow poster got it right, and this looks like the only way to replace a style file.



  • Ok, so update:

    The file is now working if i use this syntax:

    {{#xlsxReplace "xl/styles.xml"}}
    {#asset style.xml}
    {{/xlsxReplace}}

    Just removing the extra curly bracket at the end, the file now works locally, and on the test server.

    However, virtually identical files with the extra curly bracket will also work.

    It also does not explain why the same file was working locally but not on the test server



  • I apologize for not mentioning the actual typo. You got it right then.

    {{#xlsxReplace "xl/styles.xml"}}
    {#asset style.xml}
    {{/xlsxReplace}}
    

    This is actually older v2 syntax. Its still compatible with v3, but now we use the following
    https://jsreport.net/learn/assets

    {{#xlsxReplace "xl/styles.xml"}}
    {{asset "style.xml"}}
    {{/xlsxReplace}}
    

    However, virtually identical files with the extra curly bracket will also work.
    It also does not explain why the same file was working locally but not on the test server

    I have tried replicating the issue and getting some hypotheses why it works for you on one server and not on the other, but unfortunately, I don't know.


Log in to reply
 

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