• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Export to Excel using Jsp

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Kalyan, Please check your private messages.

Eric
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did you try to change the encoding and see what happens?

Eric
 
Ranch Hand
Posts: 37
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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:
 
I wish to win the lottery. I wish for a lovely piece of pie. And I wish for a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic