目前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
POIFS OLE2 Filesystem poi Required to work with OLE2 / POIFS based files
HPSF OLE2 Property Sets poi  
HSSF Excel XLS poi For HSSF only, if common SS is needed see below
HSLF PowerPoint PPT poi-scratchpad  
HWPF Word DOC poi-scratchpad  
HDGF Visio VSD poi-scratchpad  
HPBF Publisher PUB poi-scratchpad  
HSMF Outlook MSG poi-scratchpad  
OpenXML4J OOXML poi-ooxml plus one of
poi-ooxml-schemas, ooxml-schemas
Only one schemas jar is needed, see below for differences
XSSF Excel XLSX poi-ooxml  
XSLF PowerPoint PPTX poi-ooxml  
XWPF Word DOCX poi-ooxml  
Common SS 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。

当操作excel2007以上的版本的时候,需要导入poi-ooxml-version-yyyymmdd.jar。当我导入之后,的确是可以调用excel2007的操作类了  例如:XSSFWorkbook.可是当项目调试的时候,会报java.lang.ClassNotFoundException: org.apache.xmlbeans.XmlObject   这个错误,在操作office2007还要加入一个包xbean.jar ,原以为导入这个包之后,就万事大吉了。可是接下来又报错了,查资料发现还是需要导入poi-ooxml-schemas-version-yyyymmdd.jar。

poi jar包的作用的更多相关文章

  1. Spring中各个jar包的作用

    spring.jar 是包含有完整发布模块的单个jar 包.但是不包括mock.jar, aspects.jar, spring-portlet.jar, and spring-hibernate2. ...

  2. JAVA、android中常用的一些jar包的作用

    正文: 这里主要介绍的是hibernate使用到的.jar Hibernate一共包括了23个jar包,令人眼花缭乱.本文将详细讲解Hibernate每个jar包的作用,便于你在应用中根据自己的需要进 ...

  3. hibernate的各个jar包的作用

    hibernate的各个jar包的作用 最基本的Hibernate3.3.2之 JAR包(必要): 包名 位置 用途 hibernate3.jar /hibernate 核心JAR包 antlr.ja ...

  4. POI各Jar包的作用(转)

    目前POI的最新发布版本是3.10_FINAL.该版本保护的jar包有: Maven artifactId Prerequisites JAR poi commons-logging, commons ...

  5. 【转】常用jar包的作用了解

    发项目的过程中,经常需要用到一写jar包,现在对其中的一写jar的作用,做下总结,也算是避免少引或者多引jar包吧,欢迎大家补充.谢谢. 1.apache的一写jar commons-collecti ...

  6. 一些jar包的作用

    发项目的过程中,经常需要用到一写jar包,现在对其中的一写jar的作用,做下总结,也算是避免少引或者多引jar包吧,欢迎大家补充.谢谢. 1.apache的一写jar commons-collecti ...

  7. 使用maven引入Apache poi jar包

    maven构建的项目-->pom.xml文件 eclipse提供Dependencies直接添加依赖jar包的工具:直接搜索poi以及poi-ooxml即可,maven会自动依赖需要的jar包: ...

  8. ssm框架所需jar包整理及各jar包的作用

    以下是我目前新搭建的ssm项目的pom.xml 之后如果需要其他的话再加 <?xml version="1.0" encoding="UTF-8"?> ...

  9. spring有关jar包的作用

    参考的是spring官网spring4.3版本. 链接:https://docs.spring.io/spring/docs/4.3.19.RELEASE/spring-framework-refer ...

随机推荐

  1. 通过hibernate session.connection()获得数据库连接时,导致的查询缓慢甚至假死机问题

    在使用hibernate的应用中,如果需要直接使用Java.sql.Connection,一般我们是通过hibernate的session.connection()获得的,然后session.clos ...

  2. WinForm 快捷键设置(转载)

    1.Alt+*(按钮快捷键) 按钮快捷键也为最常用快捷键,其设置也故为简单.在大家给button.label.menuStrip等其他控件的Text属性指定名称时,在其后面加上‘&’然后在加上 ...

  3. 常见MVC框架比较

    常见MVC框架比较 运行性能上: Jsp+servlet>struts1>spring mvc>struts2+freemarker>>struts2,ognl,值栈. ...

  4. jsp页面价格

    <div class='flo_left'> <h2 class='red'>订货价¥${productEntity.agentsPrice}</h2> <h ...

  5. Version=1.0.0.0, Culture=neutral, PublicKeyToken=null

    What it is saying is, it found the DLL, but it couldn't find a type named "namespace.User" ...

  6. 状态压缩 DP

    D - Hie with the Pie Crawling in process... Crawling failed Time Limit:2000MS     Memory Limit:65536 ...

  7. asp.net 获取当前项目的根目录路径

    获取网站根目录的方法有几种如: Server.MapPath(Request.ServerVariables["PATH_INFO"]) Server.MapPath(" ...

  8. 字符串—strcpy

    来自——百度百科   原型声明:char *strcpy(char* dest, const char *src); 头文件:#include <string.h> 和 #include ...

  9. U3D--常用属性(不完整,待加)

    1. AddComponentMenu 描述:这个属性可以在Component这个菜单栏下加自己定义的子菜单,这样可以快速添加常用的脚本.该属性要用在类上. using UnityEngine; us ...

  10. 杭电ACM 1013 Digital Root

    #include<stdio.h>#include<stdlib.h>#include<string.h>int main(){char s[100000];int ...