Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Does anyone know how to export data from JSP to excel  RSS feed

 
sudhir porumamilla
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
Currently im working on JSP project and i want to export
the data from JSP to MS Excel.
but im not aware of the procedure.
adv. thx for ur help
sudhir
 
s choukse
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
What you have to do is on the load of page or on click of a button (whatever is the trigger of export to excel) you have to change the mime type in the JSP header. Doing thus browser will propt for Open or Save file.
-Saurabh
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 36417
454
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sudhir,
In addition to the MIME type, you need to think about the file content. If you have a simple file, you can just output to the stream in comma delimited format. If you want more control, you can use a framework like Apache's HSSF
 
Venky Anant
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sudhir,
What Jeanne Boyarsky said is Exactly right.. if you use Apache HSSF TOol you will have an full control like you can have your own Font and thingslike that and there is one more tool called JexcelApi.. But I would suggest you to use HSSF. That is an Awesome tool..
Thanks
-Venky
 
himanshu patel
Ranch Hand
Posts: 205
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You may like to explore "com.f1j.swing.JBook" API.
See link here.
http://www.emiddleware.com/Node/Knowledge_Base/FAQ/body_faq.html
 
Jayson Falkner
Author
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A really easy way to solve 80% of your JSP to Excel data exporting is to simply use a tab-delimited file and set the MIME type to application/vnd.ms-excel. Try it out! It really is as easy as something such as:
<%@ page contentType="application/vnd.ms-excel" %>
Column1[tab]Column2[tab]Column3
1 [tab]5 [tab]2
3 [tab]2 [tab]1
6 [tab]5 [tab]8
And so on... Of course, replace the [tab] entries above with actual presses of the 'tab' key.
This method doesn't let you do much with controlling fonts and graphics, but if you don't need to do that, you are set!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!