p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Reporting Services (http://p2p.wrox.com/forumdisplay.php?f=205)
-   -   Export to Excel as .csv file from JSP (http://p2p.wrox.com/showthread.php?t=40227)

naheedv March 22nd, 2006 04:52 PM

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



naheedv April 5th, 2006 09:12 AM


IS THERE ANY HELP FROM ANYONE????


fuzzy May 10th, 2006 10:31 AM

Try it like this:
Code:

response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-disposition","attachment;filename=Export.csv");

Instead of Export.csv you can put your desired filename.

PS: don't be so inpacient when you ask someone to help you FOR FREE. All the help in here can be considered [u]DONATION</u>, so try to behave if you want to get it from now one.

I like money, but I'm not crazy about them. Seems the feeling is mutual.

gourav_ajmani November 30th, 2006 08:04 AM

HI Fuzzy ,I have tried what u said to do..That is to add the two lines in JSP..But the problem is when I click on the link which should open Excel sheet .it ask me to save or open the excel file.when i do so it prints the whole jsp page in Excel.

Plz help me on the same

Thanx


All times are GMT -4. The time now is 05:25 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.