0
点赞
收藏
分享

微信扫一扫

POI (excel) - API使用与参考

勇敢乌龟 2022-06-11 阅读 76

【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

POI (excel) - API使用与参考_excel

参考​​三者说明​​​(​​https://poi.apache.org/spreadsheet/index.html​​)。

【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

POI (excel) - API使用与参考_java_02

​​参考​​​(​​https://poi.apache.org/spreadsheet/how-to.html#user_api​​)。

【3】如何快速使用HSSF和XSSF

参考​​Quick Guide​​

POI (excel) - API使用与参考_ide_03


举报

相关推荐

0 条评论