Quick introduction to Apache POI
Chapters
POI API to work with spreadsheets - The bare minimum
This chapter highlights some of the core APIs we will end up using in this tutorial.
Workbook
The org.apache.poi.ss.usermodel package contains base interface called Workbook of all classes that is used to create and maintain Excel.
The two classes for this interface are as follows:
- XSSFWorkbook: This is Compatible with versions 2007 of MSOffice or later.It contains methods to write and read OpenOffice xml and Excel files in .xlsx and .xlx format.
You can read the complete list of constructors and methods available on the API page from the link below
http://poi.apache.org/apidocs/org/apache/poi/xssf/usermodel/XSSFWorkbook.html
- HSSFWorkbook: This is compatible with Version 97 -2003 of MS office. It contains methods to write and read Microsoft Excel files.
You can read the complete list of constructors and methods available on the API page from the link below
http://poi.apache.org/apidocs/org/apache/poi/hssf/usermodel/HSSFWorkbook.html
WorkbookUtil
This class have quite a few helper methods for when working with Usermodel Workbooks.
More on API can be read from the link below
http://poi.apache.org/apidocs/org/apache/poi/ss/util/WorkbookUtil.html
Row Interface
This interface is a high level representation of a row of a spreadsheet.
More on API can be read from the link below
http://poi.apache.org/apidocs/org/apache/poi/ss/usermodel/Row.html
Cell Interface
Cell is a high level representation of a cell in a row of a spreadsheet.
Cells can be numeric, formula-based or general text and is specified by a cell type. Key things to note are
- String cells cannot contain numbers.
- Numeric cells cannot contain strings.
- Our client program will handle the conversions where applicable.
- Formula cells have the formula string along with the formula result, which can be numeric or text value.
Cells should have their index specified which is 0 based, before being added to a row.
More on cell interface can be read from the link below
http://poi.apache.org/apidocs/org/apache/poi/ss/usermodel/Cell.html
There are numrous other API classes which we will not cover in this quick introduction tutorial
However, Details on current version of Apache POI API can be found here
Description
This tutorial covers Apache POI, This tutorial is divided into 12 parts as listed below
- What is Apache POI
- Environment
- Core Classes
- Workbooks
- Spreadsheets
- Cells
- Fonts
- Formula
- Hyperlink and defiining Print Area
- Database
Let us know if we made any error, your feedback is important.
Prerequisites
Its is important that you have working knowledge of Java Programming language
Audience
Beginners seeking a quick introduction to Apache POI
Learning Objectives
To get you started with Apache POI
Author: Subject Coach
Added on: 10th Mar 2015
You must be logged in as Student to ask a Question.
None just yet!