• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Exporting to excel

 
venkatesh warlu
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi guys i m using struts framework... i m gettin data using queries nd displayin it as a iterated table in my jsp page.. i need to export the fetched data as a excel sheet .. how do i approach this problem??? kindly help me..
 
Raghavan Muthu
Ranch Hand
Posts: 3381
Mac MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can try using JExcel or Apache POI (HSSF) framework for the same.
 
venkatesh warlu
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for the reply ,
i tried the links you sent... its mainly to read and write excel sheet.. i want my table to be exported as a excel sheet so that users can download it to excel sheet and take print outs of it... can you be more specific and clear in solution...
 
Raghavan Muthu
Ranch Hand
Posts: 3381
Mac MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, thats right. These APIs give you a provision to read and write the data into Excel sheets. What you can do is, the same data which you read and give it to HTML for rendering in the browser, you can pass it to the API so that it can write it into the Excel Sheet.

If you are passing a collection (say an ArrayList) to a JSP for rendering/writing it into HTML, you can pass the same list of values to any of these APIs and you need to manipulate how they are supposed to be written into the Excel sheet of your choice!

Does that help? Go through some tutorials/documentation on 'how to use' the API. You may get more clear information.
 
Jetendra Ivaturi
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We have exclusive methods to create workbook and worksheets. Pass your arraylist to the same it ll create you the excel sheet.
 
Raghavan Muthu
Ranch Hand
Posts: 3381
Mac MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jetendra Ivaturi:
We have exclusive methods to create workbook and worksheets.


We??
 
sandeep Kumar
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Venkatesh warlu,

If your JSP contains only the table to be exported, then if you set the content type to the following

<%@ page contentType="application/vnd.ms-excel" %>

Then when you send the request to that JSP page, then your table can be exported to an excel file.

Regards,
Sandeep.
 
Sahana Hegde
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[Edit thread hijack removed]
[ July 18, 2008: Message edited by: Bear Bibeault ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic