How to suppress the file corrupt warning at Excel download?

前端 未结 8 1113
被撕碎了的回忆
被撕碎了的回忆 2020-11-27 19:21

I have a web page which links to an Excel 2007 worksheet. It is a .xls file and not .xlsx file. When I click on the link I get the usual dialog box

8条回答
  •  清歌不尽
    2020-11-27 19:37

    For the old Excel format (.xls)

    Assuming you create your spreadsheet object with this syntax:

     
    

    You would use this to create the download:

    
    
    

    For the newer Excel format (.xlsx)

    Create your spreadsheet object with this syntax:

    
    

    And use this to create the download:

    
    
    

    Thanks to Raymond Camden for the bulk of this (his example was for creating the spreadsheet in the older format -- I updated for the newer format and use slightly different MIME values).

提交回复
热议问题