【1】HSSF,XSSF and SXSSF
HSSF is the POI Project’s pure Java implementation of the Excel ‘97(-2007) file format.
XSSF is the POI Project’s pure Java implementation of the Excel 2007 OOXML (.xlsx) file format.
也就是说,HSSF支持低版本的(拓展名为 .xls);XSSF支持高版本的(拓展名为 .xlsx)。
HSSF and XSSF provides ways to read spreadsheets create, modify, read and write XLS spreadsheets.
They provide:
- low level structures for those with special needs
- an eventmodel api for efficient read-only access
//如果是只读,就是用事件模型 - a full usermodel api for creating, reading and modifying XLS files
//如果需要创建和读写,那么使用用户模型(包的区别) - 用户模型比事件模型有更高的内存占用,但是更优良。
XSSF 比HSSF更优良,内存占用也更高。可以通过这两个api访问并修改excel。
SXSSF(拥有流的特性)是XSSF的扩展,拥有XSSF特性却是低内存占用的。
操作表格的时候不提供所有行的访问权限(用到取到,不用存盘)。
以下三个方面是SXSSF不支持的:
Only a limited number of rows are accessible at a point in time. Sheet.clone() is not supported. Formula evaluation is not supported
【2】 Different ways
There are a few different ways to access the HSSF API. These have different characteristics, so you should read up on all to select the best for you.
User API (HSSF and XSSF) Event API (HSSF Only) Event API with extensions to be Record Aware (HSSF Only) XSSF and SAX (Event API) SXSSF (Streaming User API) Low Level API
【3】如何快速使用HSSF和XSSF
参考Quick Guide