https://poi.apache.org/components/spreadsheet/index.html(翻译1)

POI-HSSF and POI-XSSF/SXSSF - Java API To Access Microsoft Excel Format Files

Overview

Overview

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是java对97-07版excel的实现,XSSF是对2007版(.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

HSSF和XSSF提供对电子表格创建,修改,读取,写入的方式,他们提供如下:    

  • 低级别架构为有特殊需要的人
  • 一个高效的eventmodel api 只读访问
  • 一个完整的usermodel api 对于xls文件的创建,修改,读取

For people converting from pure HSSF usermodel, who wish to use the joint SS Usermodel for HSSF and XSSF support, then see the ss usermodel converting guide.

对于从纯HSSF 用户模式转换过来的用户,希望使用 联合ss对hssf,xssf支持,需要去看ss usermodel converting guide.

An alternate way of generating a spreadsheet is via the Cocoon serializer (yet you'll still be using HSSF indirectly). With Cocoon you can serialize any XML datasource (which might be a ESQL page outputting in SQL for instance) by simply applying the stylesheet and designating the serializer.

另一种生成电子表格的替换方法是通过COcoon序列化器(但是你仍要间接的使用HSSF),使用Cocon你可以序列化任何XML数据源(例如,哪个可能是用SQL输出的ESQL页面)通过简单应用样式和指定序列化方式

If you're merely reading spreadsheet data, then use the eventmodel api in either the org.apache.poi.hssf.eventusermodel package, or the org.apache.poi.xssf.eventusermodel package, depending on your file format.

如果你只是读取电子表格的数据,使用  org.apache.poi.hssf.eventusermodel package, or the org.apache.poi.xssf.eventusermode eventmodel api  ,取决于你的文件类型。

If you're modifying spreadsheet data then use the usermodel api. You can also generate spreadsheets this way.

如果你想修改电子表格就需要使用usermodel api ,你也可以使用它创建电子表格

Note that the usermodel system has a higher memory footprint than the low level eventusermodel, but has the major advantage of being much simpler to work with. Also please be aware that as the new XSSF supported Excel 2007 OOXML (.xlsx) files are XML based, the memory footprint for processing them is higher than for the older HSSF supported (.xls) binary files.

注意usermodel系统比低级别的eventusermodel拥有更高的内存占用率,但是主要的优势是使用简单。还有应该注意新的XSSF支持基于XML构建的007excel,但是内存占有率高于老版本的HSSF的二进制文件

SXSSF (Since POI 3.8 beta3)SSF (Since POI 3.8 beta3)

Since 3.8-beta3, POI provides a low-memory footprint SXSSF API built on top of XSSF.

自从3.8版本后,POI提供了一个低内存占用率的SXXF构建于XSSF之上

SXSSF is an API-compatible streaming extension of XSSF to be used when very large spreadsheets have to be produced, and heap space is limited. SXSSF achieves its low memory footprint by limiting access to the rows that are within a sliding window, while XSSF gives access to all rows in the document. Older rows that are no longer in the window become inaccessible, as they are written to the disk.

SXXF 是一个对一XSSF 的API兼容性的流扩展,用于大的电子表格产生,并且在空间有限的情况下。SXXF实现它的低内存占用率是通过限制访问行数在一个滑动窗内。然而XSSF允许访问所有行,不再位于窗口中的旧行在写入磁盘时变得不可访问。

In auto-flush mode the size of the access window can be specified, to hold a certain number of rows in memory. When that value is reached, the creation of an additional row causes the row with the lowest index to to be removed from the access window and written to disk. Or, the window size can be set to grow dynamically; it can be trimmed periodically by an explicit call to flushRows(int keepRows) as needed.

自动刷新模式下可以指定访问窗口的大小,在内存中保存一定数量的行,当达到设定的值的时候。创建附加行会导致索引最低的行从访问窗口中删除并写入磁盘,或者,可以将窗口大小设置为动态增长,它可以根据需要通过显式调用flushRows(int keepRows)周期性地进行修剪。

Due to the streaming nature of the implementation, there are the following limitations when compared to XSSF:

  • Only a limited number of rows are accessible at a point in time.
  • Sheet.clone() is not supported.
  • Formula evaluation is not supported

由于实现的流媒体特性,与XSSF相比存在以下限制:

  • 在某个时间只能访问限制的行数
  • 不支持sheet的克隆
  • 不支持公式计算

 

See more details at SXSSF How-To

The table below synopsizes the comparative features of POI's Spreadsheet API:

下面的表格对POI API比较特性做了概述

Spreadsheet API Feature Summary

 HSSF(.xls)XSSF(.xlsx)
 eventmodelusermodeleventmodelusermodelSXXF
APITypeStreaming(ala SAX)In memory tree(ala DOM)Streaming(ala SAX)In memory tree(ala DOM)Buffered Streaming
cpu和内存效率goodVariesgoodVariesgood
Forward Onlyyesnoyesnoyes
读取文件yesyesyesyesno
写入文件noyesnoyesyes
特征:     
创建 sheet/行、cellnoyesnoyesyes
cell 样式noyesnoyesyes
删除 sheet/行、cellnoyesnoyesno
行移位变换,noyesnoyesno
sheet克隆noyesnoyesno
公式计算noyesnoyesno
cell commentsnoyesnoyesno
图片noyesnoyesyes
 1.eventmodel  只能读,不能修改文件,内存占用率地   2.SXXF只能写不能读    3.既读又写用usermodel,但是hssf是内存占有率最小的 
  
  
  
  
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值