Apache POI and Open Office document formats

Apache POI from version 3.6 onwards has support for SpreadSheetML (Microsoft’s Open Office XML standard). With SpreadSheetML you can generate Excel files as XML. The XML file needs to be compliant with the OOXML schema. The file extension for “.xlsx”.

To create a Excel document using OOXML use the command:

Workbook wb = new XSSFWorkbook();

To create in binary (OLE) format, use the below constructor for creating the workbook:

Workbook wb = new HSSFWorkbook();

That’s all! All further processing is the same for both XSSF and HSSF workbook formats.

This entry was posted in Uncategorized and tagged , , , , , , . Bookmark the permalink.

2 Responses to Apache POI and Open Office document formats

  1. srinivas says:

    Hi,

    i want to write a java code which can read the xls file as well as xlsx file irrespective of the file type

    i can read xls,xlsx files individually,if i written a code for reading xlsx can it support xls file

    Thanking you,

Leave a comment