poi各個jar的做用分別是什麼?

本文轉載於http://blog.csdn.net/szwangdf/article/details/39053859#comments,該篇文章一切版權和權力屬於@逐浪_一輩子懸命 先生全部,轉載僅供學習交流,侵權立刪。html


目前POI的最新發布版本是3.10_FINAL.該版本保護的jar包有:apache

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到底應該導入哪個。ide

實際上不少時候咱們只利用POI來操做Excel。甚至只用xls這一種格式。學習

那麼就沒有必要所有都導入了。具體應該使用哪一個JAR包請參考如下內容:ui

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

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就能夠了。.net

當咱們還要使用xlsx格式、還要導入poi-ooxml-version-yyyymmdd.jar。code

至於poi-ooxml-schemas-version-yyyymmdd.jar這個jar基本不太會用到的。component

當咱們須要操做word、ppt、viso、outlook等時須要用到poi-scratchpad-version-yyyymmdd.jar。orm

相關文章
相關標籤/搜索