File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Dowloading a Table as a csv File Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Dowloading a Table as a csv File" Watch "Dowloading a Table as a csv File" New topic
Author

Dowloading a Table as a csv File

Javoso Torso
Ranch Hand

Joined: Aug 15, 2003
Posts: 88
Hello:

In a JSF app, I am trying to find the best way to download a (HTML)table to the client as a CSV file (to be open with excel for example).

Any ideas?

Thanks!
Javo


I hate 'trial and error'<br />and I am doing it all the time
John Smith
Ranch Hand

Joined: Sep 02, 2004
Posts: 61
Parse the table to output a comma delimited list name.csv, when excel saves it back to that file it will be in the correct excel format.

if you're doing it through struts you can have it as a link pointing to an action containing the following:



This will create a file with your data and send it to the browser which will automatically deal with it by popping up a download box or displaying if the client has an excel plug-in installed, hope this is what you were after
Javoso Torso
Ranch Hand

Joined: Aug 15, 2003
Posts: 88
Thanks!

I would really like to test that.
But I am using JavaServer Faces...

What is the parallel to "response" in JavaServer Faces?

Regs,
javoso
[ December 13, 2004: Message edited by: Javoso Torso ]
Javoso Torso
Ranch Hand

Joined: Aug 15, 2003
Posts: 88
:

FacesContext.getExternalContext().getResponse();

?
[ December 13, 2004: Message edited by: Javoso Torso ]
Manish Hatwalne
Ranch Hand

Joined: Sep 22, 2001
Posts: 2578

You might want to try JExcel API as well.

HTH,
- Manish
Javoso Torso
Ranch Hand

Joined: Aug 15, 2003
Posts: 88
Thank you,

I am giving Apache POI a try!

Rgs,
javo
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Dowloading a Table as a csv File