4

What library would you guys recommend to write an excel file from Java? It has to be pure Java solution, so it will work on any platform.

Thanks, Grae

EDIT: It can't be CSV file format. It has to have column headers, data format type, etc.

peter.murray.rust
  • 37,407
  • 44
  • 153
  • 217
GC_
  • 1,673
  • 6
  • 23
  • 39
  • Is CSV format acceptable? It's easier and more universal. – BalusC Jan 29 '11 at 23:18
  • @BalusC No, thank you, though. – GC_ Jan 29 '11 at 23:19
  • 2
    Possible duplicate of [JExcelAPI vs Apache POI, which is better?](http://stackoverflow.com/questions/4763624/jexcelapi-vs-apache-poi-which-is-better) (there are no other major API's anyway). For other related questions, check [here](http://stackoverflow.com/questions/tagged/java+excel). – BalusC Jan 29 '11 at 23:21
  • @BalusC By the way, thanks for all your help on the JSF questions. – GC_ Jan 29 '11 at 23:28

2 Answers2

9

The best solution I've found for generating Microsoft document formats is the Apache POI library: http://poi.apache.org/

Jason LeBrun
  • 13,037
  • 3
  • 46
  • 42
1

Starting with MS Office 2007 Excel files are saved in Office Open XML (.xlsx) by default. Create such file with any content, rename it to .zip and look inside. It's a bunch of folders and XML files compressed together.

Java provides support for creating zip files using java.util.zip. And that's all you need.

mateusza
  • 5,341
  • 2
  • 24
  • 20