poi系列(一):使用說明

功能簡介

Apache POI提供API給Java對Microsoft Office格式檔案讀和寫的功能。

POI各jar包的作用

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

 

按照需要導入jar包及相關依賴jar包。

  poi-version.jar  (excel文件生成需要) 

  poi-ooxml-version.jar(excel,word,ppt均需要)

  poi-scratchpad-version.jar(ppt,vsd,word,viso,outlook等需要)

  poi-ooxml-schemas-version.jar(excel需要)

     poi-examples-version.jar(官方示例,開發不需要) 

  poi-excelant-version.jar(不需要)

 

當我們只要使用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。

版本發佈

https://mvnrepository.com/artifact/org.apache.poi/poi

POI 3.17是支持Java 6的最後一個版本。下一個版本將是4.0.0並且支持最小值。 Java 8。

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章