Why showing error message while opening .xls file

前端 未结 6 1461
自闭症患者
自闭症患者 2020-12-30 09:14

In my asp.net, C# application we are generating and downloading .xls file. But when I\'m trying to open, it\'s giving a message

\"The file you are try

6条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-30 09:52

    The alert is a new security feature in Excel 2007 called Extension Hardening, which ensures that the file content being opened matches the extension type specified in the shell command that is attempting to open the file. The current design does not allow you to open HTML content from a web site in Excel unless the extension of the URL is .HTM/.HTML/.MHT/.MHTML. So ASP pages that return HTML and set the MIME type to something like XLS to try to force the HTML to open in Excel instead of the web browser (as expected) will always get the security alert since the content does not match the MIME type.

    http://blogs.msdn.com/b/vsofficedeveloper/archive/2008/03/11/excel-2007-extension-warning.aspx

提交回复
热议问题