Is there any other alternative for this apart from POI library for Java?
There are a few other libraries too, but I'm not sure if the can write such a thing like a chart.
If you can use the newer Office versions (the ones that use the XML based format files), than you could use a different approach:
- create a an Excel file with a newer version of Office, containing the charts you need, and some dummy data.
- unzip that excel file and extract the XML files from inside. Of most interest will be the files xl\worksheets\sheet1.xml xl\worksheets\sheet2.xml or xl\worksheets\sheet3.xml (depending on what sheets were used)
- Take a look at the file format (it's more complicated than using POI), but it shouldn't be that hard to identify the "dummy" data you entered before.
- Use Velocity or FreeMarker to transform that xml file into a template (by replacing your dummy data with variables and macros what would produce the same result)
- Write a small program (just a few lines) that takes you real data, merges with the template, and packs everything back in a zip, but puts the *.xlsx extension.
I know that the above steps look a little complicated, but if you don't have too complicated Excel files, it should be easier than it looks.