File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes Table display as Excel file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Table display as Excel file" Watch "Table display as Excel file" New topic
Author

Table display as Excel file

Lee Barney
Ranch Hand

Joined: May 07, 2003
Posts: 37
I have been trying to get IE 6.0 to show and embedded excel spreadsheet when a table is requested. Below is the code for the table. I have also set the following in the servelt:



Neither IE 6.0 nor Firefox display this as an excel spreadsheet. I have Office installed.

I can get Firefox to respond correctly if I use the page directive in the JSP, but this is not optimal.

Ideas?


Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Set the Content-Disposition header so that the file has an extension of ".xls"


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Lee Barney
Ranch Hand

Joined: May 07, 2003
Posts: 37
I changed the servlet code to be:



still not working.
Lee Barney
Ranch Hand

Joined: May 07, 2003
Posts: 37
I also tried:



again, this works in Firefox but not IE 6.0
Paul Michael
Ranch Hand

Joined: Jul 02, 2001
Posts: 697
Is your webapp using a GZIP filter? A friend suggested installing this fix:

Update for Internet Explorer 6 SP1 - Internet Explorer Does Not Correctly Decompress Data with GZIP Data Compression Method (837251)


SCJP 1.2 (89%), SCWCD 1.3 (94%), IBM 486 (90%), SCJA Beta (96%), SCEA (91% / 77%), SCEA 5 P1 (77%), SCBCD 5 (85%)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Table display as Excel file
 
Similar Threads
Table Allignment problem in IE 6.0
XML Info Database Help
Displaying all the months in the year
table problem?
how to import jsp table to excel sheet