aspose file tools*
The moose likes JSP and the fly likes Exporting to excel Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Exporting to excel" Watch "Exporting to excel" New topic
Author

Exporting to excel

venkatesh warlu
Ranch Hand

Joined: Mar 11, 2008
Posts: 33
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

Joined: Apr 20, 2006
Posts: 3344

You can try using JExcel or Apache POI (HSSF) framework for the same.


Everything has got its own deadline including one's EGO!
[CodeBarn] [Java Concepts-easily] [Corey's articles] [SCJP-SUN] [Servlet Examples] [Java Beginners FAQ] [Sun-Java Tutorials] [Java Coding Guidelines]
venkatesh warlu
Ranch Hand

Joined: Mar 11, 2008
Posts: 33
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

Joined: Apr 20, 2006
Posts: 3344

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

Joined: Feb 08, 2007
Posts: 159
We have exclusive methods to create workbook and worksheets. Pass your arraylist to the same it ll create you the excel sheet.


SCJP 1.4 & 1.5, SCWCD 1.5. Learn and Let Learn.
Raghavan Muthu
Ranch Hand

Joined: Apr 20, 2006
Posts: 3344

Originally posted by Jetendra Ivaturi:
We have exclusive methods to create workbook and worksheets.


We??
sandeep Kumar
Ranch Hand

Joined: Sep 19, 2007
Posts: 41
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

Joined: Jan 27, 2008
Posts: 67
[Edit thread hijack removed]
[ July 18, 2008: Message edited by: Bear Bibeault ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Exporting to excel