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。

 

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