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.

Advertisements
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 Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s