Open In App

Introduction to Apache POI

Apache POI is an open-source java library to create and manipulate various file formats based on Microsoft Office. Using POI, one should be able to perform create, modify and display/read operations on the following file formats. For Example, Java doesn’t provide built-in support for working with excel files, so we need to look for open-source APIs for the job. 

Apache POI provides Java API for manipulating various file formats based on the Office Open XML (OOXML) standard and OLE2 standard from Microsoft. Apache POI releases are available under the Apache License (V2.0). 



Some important features of Apache POI are as follows: 

Commonly used components of Apache POI



  1. HSSF (Horrible Spreadsheet Format): It is used to read and write xls format of MS-Excel files.
  2. XSSF (XML Spreadsheet Format): It is used for xlsx file format of MS-Excel.
  3. POIFS (Poor Obfuscation Implementation File System): This component is the basic factor of all other POI elements. It is used to read different files explicitly.
  4. HWPF (Horrible Word Processor Format): It is used to read and write doc extension files of MS-Word.
  5. HSLF (Horrible Slide Layout Format): It is used for read, create, and edit PowerPoint presentations.

Environment

Apache POI runtime dependencies: If you are working on a Maven project, you can include the POI dependency in the pom.xml file using the below set of lines of code.

<dependency> 
    <groupId>org.apache.poi</groupId> 
    <artifactId>poi</artifactId> 
    <version>3.9</version> 
</dependency> 

Now, in order to add this in eclipse, go to 

Window -> Show View -> Other -> Maven -> Maven Repositories

If you are not using maven, then you can download maven jar files from the POI download page. Include the following jar files minimum to run the sample code: 

Follow this Link to see how to add external jars in eclipse.

Article Tags :