aspose file tools*
The moose likes Java in General and the fly likes JAVA AND EXCEL CHART Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "JAVA AND EXCEL CHART" Watch "JAVA AND EXCEL CHART" New topic
Author

JAVA AND EXCEL CHART

swami dorai
Greenhorn

Joined: May 03, 2004
Posts: 15
I need to create some java program behind the webserver which will read some values from the DB based on the input. i then need to open an excel application dynamically to create an excel chart using those values. Is there a way for this.

Is there any freeware tools which I can make use of ?

thanks in advance
Swami
Damanjit Kaur
Ranch Hand

Joined: Oct 18, 2004
Posts: 346
You can use Apache POI API.
http://jakarta.apache.org/poi/
Nigel Browne
Ranch Hand

Joined: May 15, 2001
Posts: 673
Originally posted by Damanjit Kaur:
You can use Apache POI API.
http://jakarta.apache.org/poi/


POI doesn't include support for excel charts at the moment.
swami dorai
Greenhorn

Joined: May 03, 2004
Posts: 15
I thought the POI still does not support drawing charts on the excel. Correct me if I am wrong.

Thanks
Damanjit Kaur
Ranch Hand

Joined: Oct 18, 2004
Posts: 346
Well , I just asked my colleauge who had given presentation on POI. As told by him,You can't create excel chart through java. but if you already have chart template in an excel file then modifying the data in the range will be refelcted in the chart.
swami dorai
Greenhorn

Joined: May 03, 2004
Posts: 15
Hi Damanjit,
Thanks for the info. Does this mean that I should have one template excel file(with chart template) for every report and update them with the data. Will this work over the web, ie, I have to put this logic somewhere on my servlet.

Has someone done this or is there any links to refer to.

Thanks a lot.
Damanjit Kaur
Ranch Hand

Joined: Oct 18, 2004
Posts: 346
Yes thats what I mean you need to create templates.

I don't know how to upload excel file with chart on web browser. However to upload the chart, may be first using POI you get access to chart range in excel file and then using jasper reports convert it to pdf file which can be then uploaded on web. Might be a bad idea but I don't know of other things.

http://jasperreports.sourceforge.net/

There is an excel jdbc driver too an alternative to POI/JIntegra.
https://xlsql.dev.java.net/
swami dorai
Greenhorn

Joined: May 03, 2004
Posts: 15
In the servlet, after I update the excel file with new data, there should be a way to send the file to the browser(maybe use redirect).

or if I set the content-type to excel, the below code might work ...

response.setContentType( "application/vnd.ms-excel ");
response.setHeader( "Content-Disposition ", "inline; filename=xlsFile.xls ");
out = new DataOutputStream(response.getOutputStream());
out.write(data.toByteArray());
out.flush();

Thanks for your time.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JAVA AND EXCEL CHART