wood burning stoves 2.0*
The moose likes Java in General and the fly likes creating excel file by servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "creating excel file by servlet" Watch "creating excel file by servlet" New topic
Author

creating excel file by servlet

Ramneek Handa
Ranch Hand

Joined: Nov 10, 2000
Posts: 44
Hi,
For getting reports in excel the one way is to export the data from database and display the report. but this is very difficult to do where I need to genrate it daliy.
that will be the best if this can be done on fly /dinamically by setting some mime type or something like that.
do somebody can help me out in that direction.
regards,
Bobby ;-}
Anil Vupputuri
Ranch Hand

Joined: Oct 31, 2000
Posts: 527
U can specify the MIME type using



SCJP 1.5, SCEA, ICED (287,484,486)
Ramneek Handa
Ranch Hand

Joined: Nov 10, 2000
Posts: 44
that's fine setting mime to html/excel but that is just to tell the browser that the response is having excel sheet. it will not prepare the report in excel format.
how to create excel sheet from servlet/jsp/java so that it could be readable through MS Excel, that's something i wanted to know .
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
Excel is often set up to automatically start and load when you click on a csv file (comma-separated-values), so this is probably the simplest way to get an "excel" file from a servlet. Generate your rows and columns in csv, with an appropriate mime type and a filename of something.csv. Then when the user saves the results to disk and clicks on it later, Excel should start up and load the data.


Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
Ramneek Handa
Ranch Hand

Joined: Nov 10, 2000
Posts: 44
Thanks Frank that's a good idea . I will make use of it to start with but I was looking for something where I can create report in proper format(having good presentation) instead of just value. I have a strong feeling that there should be a way for doing that through some api or whatever.
rgds.
Anil Vupputuri
Ranch Hand

Joined: Oct 31, 2000
Posts: 527
Originally posted by Ramneek Handa:
that's fine setting mime to html/excel but that is just to tell the browser that the response is having excel sheet. it will not prepare the report in excel format.
how to create excel sheet from servlet/jsp/java so that it could be readable through MS Excel, that's something i wanted to know .

Yeah ...
This link may be useful writing CSV file..http://search.java.sun.com/query.html?col=nforum&q p=%2Bboard%3A%22discuss.sun.java.servlet.development.kit%22&qt=excel

[This message has been edited by Anil Vupputuri (edited March 20, 2001).]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: creating excel file by servlet
 
Similar Threads
excel file opening,editing and saving
JSP data to CSV format conversion
how can convert excel to pdf .
Reading XLS file
exporting to CSV