Return to site

EXCEL + JAVA = APACHE POI

· java

Define

Apache POI is a popular API that allows programmers to create, modify, and display MS Office files using Java programs. It is an open source library developed and distributed by Apache Software Foundation to design or modify Microsoft Office files using Java program. It contains classes and methods to decode the user input data or a file into MS Office documents.

Snippet

API

  • HSSF is prefixed before the class name to indicate operations related to a Microsoft Excel 2003 file.
  • XSSF is prefixed before the class name to indicate operations related to a Microsoft Excel 2007 file or later.
  • XSSFWorkbook and HSSFWorkbook are classes which act as an Excel Workbook
  • HSSFSheet and XSSFSheet are classes which act as an Excel Worksheet
  • Row defines an Excel row
  • Cell defines an Excel cell addressed in reference to a row.

Maven dependency

<dependency>
<groupId>org.apache.poi</groupId>
           <artifactId>poi-ooxml</artifactId>
           <version>3.15</version>
</dependency>