Opening excel files from the internet opens a blank excel window

后端 未结 7 931
一生所求
一生所求 2021-01-12 08:42

A method in dumping a GridView to an Excel file to download/open from the internet was recently broken with new Windows Updates.

My code dumps from a GridView to an

7条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-12 09:44

    changing the security options was unfortunately not an option, but it turns out that if you export to CSV instead of XLS then the file will open in Excel ignoring the trust center stuff.

    We're in Classic ASP, so we change the page from exporting an HTML table format to CSV and changed our header and contenttype to this:

    Response.AddHeader "content-disposition", "attachment; filename=search_results.csv"
    Response.ContentType = "text/csv"
    

    and did line breaks with: Response.Write (chr(10))

提交回复
热议问题