我添加了所有这些依赖项,但仍未导入org.apache.poi.POIXMLDocument
。下面的代码我需要它。有什么问题?
`POIXMLDocument.hasOOXMLHeader(file.getInputStream())`
如果我点击错误,它会手动导入它,一切都很好,但我想这是错误的
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.7</version>
</dependency>
<dependency>
<groupId>org.apache.tika</groupId>
<artifactId>tika-app</artifactId>
<version>0.6</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.5-beta4</version>
</dependency>
<dependency>
<groupId>org.apache.xmlbeans</groupId>
<artifactId>xmlbeans</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>xmlbeans</groupId>
<artifactId>xbean</artifactId>
<version>2.1.0</version>
</dependency>
<dependency>
<groupId>xmlbeans</groupId>
<artifactId>xbean_xpath</artifactId>
<version>2.1.0</version>
</dependency>
<dependency>
<groupId>org.apache.xmlbeans</groupId>
<artifactId>xmlbeans-qname</artifactId>
<version>2.3.0</version>
</dependency>
答案 0 :(得分:0)
使用以下代码代替pom中的代码
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.5-FINAL</version>
</dependency>
答案 1 :(得分:0)
请更改工件的版本
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.6</version>
</dependency>
并重新执行maven
答案 2 :(得分:0)
在POM中添加此依赖项:
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.7</version>
</dependency>
hasOOXMLHeader()方法中的InputStream,它支持标记/重置,或者是PushbackInputStream
答案 3 :(得分:0)
jar文件在Maven依赖项中,我使用ctrl+shift+o
导入它,它运行正常。
答案 4 :(得分:0)
用于处理.xlsx文件的ooxml和ooxml引用的是xml,因此我们需要在pom.xml中引用以下三个依赖项
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.9</version>
</dependency>
<dependency>
groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
<version>1.4.01</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.9</version>
<exclusions>
<exclusion>
<artifactId>xml-apis</artifactI`enter code here`d>
<groupId>xml-apis</groupId>
</exclusion>
</exclusions>
</dependency>