• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JAVA AND EXCEL CHART

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 346
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can use Apache POI API.
http://jakarta.apache.org/poi/
 
Ranch Hand
Posts: 704
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I thought the POI still does not support drawing charts on the excel. Correct me if I am wrong.

Thanks
 
Damanjit Kaur
Ranch Hand
Posts: 346
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 346
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic