首页 > 解决方案 > 找不到 apache poi 的类

问题描述


我正在使用 Apache POI (3.17) 创建一些带有图表的工作表。
我使用时遇到以下问题:

XSSFChartAxis bottomAxis = chart.getChartAxisFactory().createCategoryAxis(AxisPosition.BOTTOM);
bottomAxis.getMajorGridLines(); // here give error


它抛出:

org.openxmlformats.schemas.drawingml.x2006.chart.CTChartLines 类型无法解析。它是从所需的 .class 文件中间接引用的
XSSFChartAxis 类型中的方法 getMajorGridLines() 指的是缺少的类型 CTChartLines
来自 CTValAx 类型的 addNewMajorGridlines() 方法指的是缺少的类型 CTChartLines

我的 pom.xml

<dependency>
    <groupId>org.apache.poi</groupId>
    <artifactId>poi</artifactId>
    <version>3.17</version>
</dependency>
<dependency>
    <groupId>org.apache.poi</groupId>
    <artifactId>poi-ooxml</artifactId>
    <version>3.17</version>
</dependency>

我在 ooxml-schemas 1.3 上找到了这个类,但现在我们正在使用 poi-ooxml-schemas 3.17。
我怎么解决这个问题?

标签: javaapache-poi

解决方案


@Gagravarr 感谢您的回复,我搜索的方式找不到此链接。我添加了依赖项,没有更多的错误。

<dependency>
    <groupId>org.apache.poi</groupId>
    <artifactId>ooxml-schemas</artifactId>
    <version>1.3</version>
</dependency>

推荐阅读