Excel cannot open file "filename.xlsx" because file format is not a valid error in IE8

I am trying to open excel 2007 from jsp (ie) if the user clicks on the create button of the report button dialog box with the open / save button (this is a normal download dialog). if the user clicks on the warning button with the open message " Excel cannot open the Report.xlsx file because the file format or extension is invalid ." I get this error only in IE8 and MS 2007 combinations, not in IE6 and MS 2007 combinations.

Most google websites talk about the MIME type. Even I changed the MIME type to MS 2007 excel, as shown below, in my code that still receives the msg message.

I searched google completely, there is no server solution. On most websites, they asked to add a registry on the client side, but I want a fix on the server side.

This is the code ...

response.setContentType ("Application / vnd.openxmlformats-officedocument.spreadsheetml.sheet"); response.setHeader ("Content-Disposition", "attachment; filename =" "Report.xlsx");
response.setHeader ("Cache-Control", "no cache"); response.setHeader ("Pragma", "public");

+5
source share

All Articles