wood burning stoves 2.0*
The moose likes HTML, CSS and JavaScript and the fly likes Export to Excel using Jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Export to Excel using Jsp" Watch "Export to Excel using Jsp" New topic
Author

Export to Excel using Jsp

Raghu Kalyan
Greenhorn

Joined: Jan 18, 2007
Posts: 2
Hi , i have a jsp which has data and needs to be exported to excel sheet. I included the below two lines in my jsp, <%response.setContentType("application/vnd.ms-excel;charset=windows-1251");%> <%response.setHeader("Content-Disposition", "attachment; filename=downloadOrders.xls" );%> i have one column which stores data like 1.1,2.1,3.1,... But in english it is printing correctly when i switch to russian language through regional settings in my PC. It is printing like below, 01月01日 (for 1.1) 02月01日 (for 2.1) Can you please help to resolve this issue wheather i need to change the charset or need to modify the code. Thanks in advance
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Kalyan, Please check your private messages.

Eric
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Did you try to change the encoding and see what happens?

Eric
Elie Hirschman
Ranch Hand

Joined: Dec 15, 2005
Posts: 37
Resurrecting this to share:
I combined simple techniques found here: http://rgagnon.com/javadetails/java-0586.html
and here: http://www.theserverside.com/discussions/thread.tss?thread_id=36310

1. Table data
Table data gets dynamically generated, and I surround it with a div tag:


2. Export button
on the page with my TABLE data, I add the following HTML:


3. Export Script
add this JS on top:


3. The JSP Export page
This new page excel.jsp does all the work:
 
Don't get me started about those stupid light bulbs.
 
subject: Export to Excel using Jsp