首页 > 编程语言 >Apache POI源码

Apache POI源码

时间:2024-03-27 09:25:28浏览次数:31  
标签:API XSSF Excel 源码 HSSF POI Apache

官网:Apache POI - the Java API for Microsoft Documents

Release Notes:

ChangeLogs:

javadocs:

HSSF - 提供读写Microsoft Excel格式档案的功能。
XSSF - 提供读写Microsoft Excel OOXML格式档案的功能。

参考:https://zhuanlan.zhihu.com/p/635548775?utm_id=0

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

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 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

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.

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.

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.

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

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.

SXSSF (Since POI 3.8 beta3)

Since 3.8-beta3, POI provides a low-memory footprint SXSSF API built on top of 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.

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.

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

See more details at SXSSF How-To

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

Spreadsheet API Feature Summary

参考:POI-HSSF and POI-XSSF/SXSSF - Java API To Access Microsoft Excel Format Files (apache.org)

标签:API,XSSF,Excel,源码,HSSF,POI,Apache
From: https://www.cnblogs.com/2008nmj/p/18098157

相关文章

  • Swoole 源码分析之 Coroutine 协程模块
    首发原文链接:Swoole源码分析之Coroutine协程模块大家好,我是码农先森。引言协程又称轻量级线程,但与线程不同的是;协程是用户级线程,不需要操作系统参与。由用户显式控制,可以在需要的时候挂起、或恢复执行。通过协程程序可以在执行的过程中保存当前的状态,并在恢复后从该状态处......
  • 【前端素材】推荐5种优质大数据分析展示页面网站设计(16)(附源码)
    一、需求分析1、功能分析大数据分析展示页面是一个用于呈现和分析大数据的平台界面,旨在帮助用户更直观、更高效地理解和利用数据。该页面通常结合了数据分析、可视化技术以及用户交互设计,以提供丰富的数据展示和分析功能。大数据分析展示页面是大数据分析过程中至关重要的一......
  • 【前端素材】推荐5种优质大数据分析展示页面网站设计(18)(附源码)
    一、需求分析1、功能分析大数据分析展示页面是一个用于呈现和分析大数据的平台界面,旨在帮助用户更直观、更高效地理解和利用数据。该页面通常结合了数据分析、可视化技术以及用户交互设计,以提供丰富的数据展示和分析功能。大数据分析展示页面是大数据分析过程中至关重要的一......
  • Java_EE源码
    Java_EE源码https://flowus.cn/aslwr/share/6c1c6342-60c3-43b5-9041-dd5ea0497e05?code=CGHHXZ【FlowUs息流】Java_EE源码使用说明:使用任意版本idea打开项目(选择mybatistest)​​在pom.xml中加入如下代码:<resource><directory>src/main/resources</directory></......
  • 2024最新 JAVA SSM 教育管理系统 (学生网上请假系统)(计算机毕业设计LW + 源码)
    教育管理系统设计项目简介本项目开发了一个教育管理系统,旨在为学校管理提供全面的解决方案。系统使用Java语言开发,采用SSM框架,结合MySQL数据库,以提高系统的稳定性和可用性。本系统涵盖了管理员登录、班级信息管理、学生请假管理、基础信息管理和用户权限管理等多个管理模......
  • 鸿鹄电子招投标系统:源码级别解析电子招投标的精髓
    招投标管理系统是一个集门户管理、立项管理、采购项目管理、采购公告管理、考核管理、报表管理、评审管理、企业管理、采购管理和系统管理于一体的综合性应用平台。它适用于招标代理、政府采购、企业采购和工程交易等业务的企业,旨在提高项目管理的效率和质量。该系统以项目为主......
  • 分享一个项目:go `file_line`,在编译器得到源码行号,减少运行期runtime消耗
    作者:张富春(ahfuzhang),转载时请注明作者和引用链接,谢谢!cnblogs博客zhihuGithub公众号:一本正经的瞎扯file_linehttps://github.com/ahfuzhang/file_lineLike__FILE__/__LINE__ofC:usegogeneratetogetsourcecodelinenumberatcompiletime.像C语言里面......
  • 【论文和源码解读】Scaling on Scales:When Do We Not Need Larger Vision Models?
    文章目录0.问题和想法1.观察和见解2.设计和框架2.1关键设计2.2模型框架3.源码解析3.1utils.py文件3.2core.py文件3.2.1forward函数中输入参数的含义3.2.2forward函数的处理逻辑4.消融实验5.未来可能的改进方向原文地址:https://arxiv.org/abs/2403.......
  • 【附源码】Node.js毕业设计个人健康信息记录移动应用app(Express)
    本系统(程序+源码)带文档lw万字以上  文末可获取本课题的源码和程序系统程序文件列表系统的选题背景和意义选题背景:随着科技的进步和互联网的普及,移动应用已经成为人们日常生活中不可或缺的一部分。在健康管理领域,个人健康信息记录移动应用APP的开发和应用也日益受到关注......
  • 【附源码】Node.js毕业设计个人健康管理小助手(Express)
    本系统(程序+源码)带文档lw万字以上  文末可获取本课题的源码和程序系统程序文件列表系统的选题背景和意义选题背景:随着社会节奏的加快和工作压力的增大,个人健康管理成为了人们日益关注的焦点。传统的健康管理方式往往需要用户手动记录健康数据,如饮食、运动、睡眠等,然后进......