views:

897

answers:

4

I've been using Apache POI to create and modify Excel spreadsheets, but I'm wondering if there is a way (even if it's with a different library, preferably open source) to create charts in Excel in the new xlsx format. It looks like POI has an HSSFChart but I believe that's for the older format (please correct me if I'm wrong). Has anyone used a Java solution to create charts in Excel?

thanks, Jeff

A: 

I have not used the Java edition of Aspose Cells but I've used the .NET edition and it is really nice. Over there it says that it can open and save XLSX. It's not free nor open source, though.

Protron
Thanks. I've used Aspose and it works well, though as you said it is rather expensive.
Jeff Storey
A: 

I prefer using JExcel to POI (the API is simpler) but it seems like they don't support the 2007 formats yet either.

matt b
The 2007 format is a requirement for our project. POI works with them well, except it doesn't do the charts.
Jeff Storey
+2  A: 

An option may be to create the charts beforehand and use POI to write the values where the chart can read them.

That is what I ended up doing, and it works great.

Make sure if you have formulas in your data, you go through every cell in the spreadsheet and evaluate them before writing it out to disk.

Nathan
Interesting idea. I'll evaluate that option.
Jeff Storey
I have used this method (with jexcel) and it was very successful. As a bonus you can delegate complicated excel stuff to someone else :)
Guillaume
A: 

You can try SmartXLS for java,it support create/edit Excel Charts in both xls and xlsx files.

liya