Reputation: 5168
In my application, I am using apache POI 3.8 for report generation.
The system is working fine and its generating report in xls format.
But when I open the xls file it given me warning before opening the file.
And here is the response type I am using...
response.setHeader("Content-Type", "application/vnd.ms-excel");
response.setHeader("Content-Disposition","attachment; filename="+xlsFileName+".xls");
I also tried with ...
response.setHeader("Content-Disposition","attachment; filename="+xlsFileName+".xls");
response.setHeader("Content-Type", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
But the problem still exist. Here in both of the case If I use file extension as ".xlsx" then Its not giving any warning and works fine.
So can anyone suggest me why it gives warning for MS-Excel 2003 format ??
Upvotes: 3
Views: 5854
Reputation: 10069
Apache POI uses HSSFWorkbook object for creating xls files and XSSFWorkbook object for xlsx files. Please check what object you used for creating xls.
http://poi.apache.org/spreadsheet/quick-guide.html
Upvotes: 8