Excel cannot open a file "filename.xlsx" because file format is not valid error in IE8
I'm trying to open excel 2007 from jsp (i.e) if user clicks on generate report button dialog box with open/save button will display(it's an ordinary download dialog box). if user clicks on open button warning msg saying "Excel开发者_如何学JAVA cannot open the file Report.xlsx because file format or extension is not valid". I'm getting this error only in IE8 & MS 2007 combination not in IE6 & MS 2007 combination.
Most of the google websites talking about MIME type. Even i changed the MIME type to MS 2007 excel as below in my code still getting the warning msg.
I searched google completely there is no server side solution. In most websites they asked to add registry in client side machine but i want server side fix.
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");
精彩评论