View Single Post
  #1 (permalink)  
Old March 22nd, 2006, 04:52 PM
naheedv naheedv is offline
Registered User
 
Join Date: Mar 2006
Location: , MI, .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Export to Excel as .csv file from JSP

Hello,
I'm trying to export my results to .csv file. The following is the code which I have in my .jsp:

//Send the results to Excel.
//response.setContentType("application/vnd.ms-excel");
response.setContentType("application/x-csv");
response.setHeader("Content-Disposition", "attachment; filename=Excel.csv");

There are 2 problems which I'm facing:
1. The File Download box comes up and when I save file, the results are have all the html tags when I open it in excel.
2. if I open the file, the download box comes up twice, and again it has all the html tags when it opens.

ANY HELP WEILL BE APPRECIATED!

thanks in advance!
Naheed