博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
[JAVA]POI(Apache POI)各Jar包的作用
阅读量:2353 次
发布时间:2019-05-10

本文共 1771 字,大约阅读时间需要 5 分钟。

文章来源:

Apache POI是 的开放源码函式库,POI提供API给Java程序对Microsoft Office格式档案读和写的功能。

 

目前POI的最新发布版本是3.10_FINAL.该版本保护的jar包有:

Maven artifactId Prerequisites JAR
poi commons-logging, commons-codec, log4j poi-version-yyyymmdd.jar
poi-scratchpad poi poi-scratchpad-version-yyyymmdd.jar
poi-ooxml poi, poi-ooxml-schemas poi-ooxml-version-yyyymmdd.jar
poi-ooxml-schemas xmlbeans poi-ooxml-schemas-version-yyyymmdd.jar
poi-examples poi, poi-scratchpad, poi-ooxml poi-examples-version-yyyymmdd.jar
ooxml-schemas xmlbeans ooxml-schemas-1.1.jar

很多人都困惑POI那么多Jar到底应该导入哪一个。

实际上很多时候我们只利用POI来操作Excel。甚至只用xls这一种格式。

那么就没有必要全部都导入了。具体应该使用哪个JAR包请参考以下内容:

Component Map

The Apache POI distribution consists of support for many document file formats. This support is provided in several Jar files. Not all of the Jars are needed for every format. The following tables show the relationships between POI components, Maven repository tags, and the project's Jar files.

Component Application type Maven artifactId Notes
OLE2 Filesystem poi Required to work with OLE2 / POIFS based files
OLE2 Property Sets poi  
Excel XLS poi For HSSF only, if common SS is needed see below
PowerPoint PPT poi-scratchpad  
Word DOC poi-scratchpad  
Visio VSD poi-scratchpad  
Publisher PUB poi-scratchpad  
Outlook MSG poi-scratchpad  
OOXML poi-ooxml plus one of
poi-ooxml-schemas, ooxml-schemas
Only one schemas jar is needed, see below for differences
Excel XLSX poi-ooxml  
PowerPoint PPTX poi-ooxml  
Word DOCX poi-ooxml  
Excel XLS and XLSX poi-ooxml WorkbookFactory and friends all require poi-ooxml, not just core poi

当我们只要使用xls格式时、只要导入poi-version-yyyymmdd.jar就可以了。

当我们还要使用xlsx格式、还要导入poi-ooxml-version-yyyymmdd.jar。

至于poi-ooxml-schemas-version-yyyymmdd.jar这个jar基本不太会用到的。

当我们需要操作word、ppt、viso、outlook等时需要用到poi-scratchpad-version-yyyymmdd.jar。

转载地址:http://cygvb.baihongyu.com/

你可能感兴趣的文章
创建敏捷产品蓝图的十个技巧
查看>>
使用GitLab来实现IOS项目的持续集成CI
查看>>
前端技术专家民工精髓V:如何增强单页应用的体验
查看>>
CSDN博文精选 微信小程序全方位解析
查看>>
致CSDN社区专家:年度盛典SDCC 2016诚邀您的加入
查看>>
在2016年学JavaScript是一种什么样的体验?
查看>>
年终技术盛会筹备中 SDCC 2016正公开征集演讲嘉宾
查看>>
微信小程序官方文档解读:如何才能避开小程序的规则“雷区”
查看>>
JavaScript运动详解:匀速运动、变速运动和曲线运动
查看>>
微信小程序架构分析系列文章
查看>>
聚焦热门框架、前端架构、工程化……,SDCC 2016前端开发专题讲师、议题大揭底...
查看>>
SDCC 2016讲师、知名JavaScript专家周爱民议题公布:有前端思想的物联网系统架构...
查看>>
Stackla前端团队Leader蒋定宇:国外前端开发者的别样人生
查看>>
从产品、技术到投资 微信小程序的全面解读
查看>>
从产品、技术到投资 小程序的全面解读
查看>>
从产品、技术到投资 小程序的全面解读
查看>>
揭秘:微信如何用libco支撑8亿用户?
查看>>
58到家周俊鹏:webpack PK fis,实现前端工程化我更喜欢前者
查看>>
前后端分离和模块化——58到家微信首页重构之路
查看>>
构建应用状态时,你应该避免不必要的复杂性
查看>>