How to specify the filename when exporting from a servlet an XLS?

  • Thread starter Thread starter orlat84
  • Start date Start date
O

orlat84

Hi,

I have a servlet that generates a report and exports it as XLS. When I
open it in Internet Explorer I get the XLS report but the problem is
that instead of the name I have set to the report I get the name of the

servlet.
For setting the name I use: response.setHeader("Content-Disposition",
"inline; report.xls");


When I want to save the file, the file name is not report.xls as
expected, but ReportGenerator.xls(the name of the servlet that
generates the report)


Even more if I use: response.setHeader("Content-Disposition",
"attachment; report.xls");


everything works as expected.


Anyone any clues?


Thank you,
Florin
 
IE does not use the suggested file name if you specify disposition-type
as "inline". I don't think there is a way to work around this. You have
to specify disposition-type as "attachment" to emphasize that the file
is intended to be saved, not displayed.

Thi - http://thith.blogspot.com
 
It works for PPTs but for Excel bad luck.

With attachement it works indeed as I have said also ... but I want to
open it in browser not to save it on disk.

Thank you anyway,
Florin
 
Back
Top