当我尝试使用下面的代码来获取数据透视表缓存定义时:
for (org.apache.poi.ooxml.POIXMLDocumentPart documentPart : pivotTable.getRelations()) {
if (documentPart instanceof XSSFPivotCacheDefinition) {
pivotCacheDefinition = (XSSFPivotCacheDefinition)documentPart;
System.out.println(pivotCacheDefinition);
}
}它抛出一个异常:
unable to resolve class org.apache.poi.ooxml.POIXMLDocumentPart
@ line 11, column 1.
import org.apache.poi.ooxml.POIXMLDocumentPart对于这个问题的任何解决方案都是值得感谢的。
发布于 2021-03-15 03:31:20
Apache poi已选择将包分配从版本3更改为版本4。
在apache poi 3.*版本中,包名称org.apache.poi用于二进制Office文件系统以及Office Open XML文件系统。这导致了poi-3.*.jar和poi-ooxml-3.*.jar都导出了org.apache.poi包的类。
这一点在apache poi 4中有所改变。现在,org.apache.poi包只包含二进制Office文件系统的类。现在,org.apache.poi.ooxml包中包含Office Open XML文件系统的类。
因此,在apache poi 4.*和更高版本中,它是org.apache.poi.ooxml.POIXMLDocumentPart。在apache poi 3.*中,它是org.apache.poi.POIXMLDocumentPart。
https://stackoverflow.com/questions/66627348
复制相似问题