Trying to save template with xlsx recipe in MSSQL.



  • That worked for saving the xlsx template but now i have a second issue, i cannot open the xlsx file that is created.

    When i run the report using your excel online service it runs fine, i can download it and open no problem, But when i disable preview with "previewInExcelOnline": false, it downloads the xlsx file but it cannot be opened. I get the following messages in excel:

    We found a problem with some content in 'report (16).xlsx'. Do you want us to try to recover as much as we can? If you trust the source of this workbook, click Yes.

    Then when i click Yes i get

    Excel cannot open the file 'report (16).xlsx' because the file format or file extension is not valid, Verify that the file has not been corrupted and that the file extension matches the format of the file.

    We found a problem with some content in 'report (16).xlsx'. Do you want us to try to recover as much as we can? If you trust the source of this workbook, click Yes.

    Then when i click Yes i get

    Excel cannot open the file 'report (16).xlsx' because the file format or file extension is not valid, Verify that the file has not been corrupted and that the file extension matches the format of the file.

    I am using excel 2016.



  • i forgot to mention i copied the template from playground for xlsx table (https://playground.jsreport.net/studio/workspace/Hy_V2BSh/4) and then uploaded a copy of the xlsx template referenced to my server to run this test.



  • It could help if you upload the downloaded/produced excel somewhere for the beginning.



  • I uploaded a zip file with the xlsx template (table.xlsx) and the produced excel (jsreport.xlsx) to the following http://apps.brunsco.net/docs/jsreport.zip .

    The template code is below:

    {{#xlsxAdd "xl/worksheets/sheet1.xml" "worksheet.sheetData[0].row"}}
        <row>
            <c t="inlineStr"><is><t>5</t></is></c>
            <c t="inlineStr"><is><t>6</t></is></c>
        </row>
    {{/xlsxAdd}}
    
    {{#xlsxMerge "xl/tables/table1.xml" "table.autoFilter"}}
        <autoFilter ref="A1:B3"/>
    {{/xlsxMerge}}
    
    {{#xlsxMerge "xl/tables/table1.xml" "table"}}
        <table ref="A1:B4"/>
    {{/xlsxMerge}}
    
    {{{xlsxPrint}}}
    


  • The provided excel is really invalid zip file. So far I cannot reproduce it.
    Can you try to provide us more information?

    • does it happen also when using default fs store
    • are you able to open the result in excel when you don't reference template, only with {{{xlsxPrint}}} in content
    • can you try it on different pc or possibly os?
    • whatever it comes to your mind could be helpful to us

    Thank you



  • Tried all that you suggested got the same results, tried this on 2 servers. Did not try another os.

    I have discovered this, the xlsx that is created on the server in the appdata folder is valid, the version that is downloaded is corrupt.

    I have included the 2 versions in a zip file http://apps.brunsco.net/docs/jsReport2.zip

    The server is running Node v6.10.0



  • I have noticed the xlsx on the server in the appdata folder is encoded as ansi and the one downloaded is utf8.

    Is this something your application choosing different encoding when saving as opposed to downloading, or is this something i need to check into on my system.

    Any ideas?



  • So you confirm that

    • the problem is not related to the mssql store, because you have same issue with fs store
    • the problem is not related to the particular template

    I cannot find an issue in our code. Can you try the download with a different browser? Does this happen also when you download the stream using API call?
    I tried again and really cannot reproduce it.

    The headers I see in F12 tools

    response

    Access-Control-Allow-Origin:*
    Connection:keep-alive
    Content-Disposition:inline; filename="report.xlsx"
    Content-Type:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
    Date:Tue, 23 May 2017 14:49:14 GMT
    File-Extension:xlsx
    Set-Cookie:render-complete=true; Path=/
    Transfer-Encoding:chunked
    X-Powered-By:Express
    X-XSS-Protection:0
    

    request

    Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
    Accept-Encoding:gzip, deflate, br
    Accept-Language:en-US,en;q=0.8,cs;q=0.6
    Cache-Control:max-age=0
    Connection:keep-alive
    Content-Length:1323
    Content-Type:application/x-www-form-urlencoded
    Cookie:session=EvE6LIvpMarDGMC_VwMbWw.8PTgq_6LF6LDqiOtHKXC5nDqHIQmSsY-UQA-dkPMhvIMTqNYZP7AvYGho3_EGxLWKoe2gclxj6PqN-3F9CfPaw.1492679112924.315360000000.8VwR5XvVoZXwLKAPMXrFjr6DA4QEqRsa-PCQqJMsNHI; render-complete=false
    Host:localhost:5488
    Origin:http://localhost:5488
    Referer:http://localhost:5488/studio/templates/r18kyD83ce
    Upgrade-Insecure-Requests:1
    User-Agent:Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36
    


  • I got it running, sort of. I installed on my dev machine which was running node v4.6.0 everthing worked fine.

    My server was running v6.10.3 which was giving me the issues, i also tried installing v7.10.0 on my server after uninstalling v6.10.3 and was getting same issue.

    I then uninstalled node again and put v4.6.0 on the server, excel downloads correctly.

    What versions of Node are supported?

    Mike



  • Well all of those. It is working for me with version 6.10.3



  • not sure what problem was, i just upgraded node to 6.10.3 and it is working, i am running, i will try rebuilding my dev machine from ground up and see what happens.

    Thank you for all your help and time, much appreciated!



  • You are welcome. It is a strange problem. If you ever figure out what could be a possible cause please post here, I'll try to replicate it.



  • The same is happening on the jsreport playground: https://playground.jsreport.net/studio/workspace/Hy_V2BSh/4 and https://playground.jsreport.net/studio/workspace/rJftqRaQ/527

    I'm looking into jsreport as an alternate way of producing excel exports but it doesn't seem to work without going through the office online viewer... which isn't really an option for us.

    Any idea what is causing the issue?



  • @jbzcooper What kind of issue do you have actually? There are many things mentioned in this thread.


Log in to reply
 

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