Create excel chart using Apache POI

javdev picture javdev · Jul 28, 2010 · Viewed 44k times · Source

I need to create excel sheet from my Java code which contains charts like Bar chart, Line Chart etc using the Apache POI library. Is it possible? I am not able to find any useful code example for the same.

Is there any other alternative for this apart from POI library for Java?

Answer

liya picture liya · Jul 29, 2010

You can only use Excel template to preserve chart with POI. It mean you create an Excel template file with chart in it and link the chart's datasource to one definedName,then you can load the template file from POI and using code to change the definedName. Current POI does not support to create Chart from scratch.