apache-poi - 在 POI 模式中找不到 CTBarChart

标签 apache-poi powerpoint

我目前正在使用 POI 使用 XSLF 编辑 PPTX 文件内嵌入图表中的数据。我找到了一个使用带有饼图的模板 ppt 的示例,效果非常好。我还尝试编辑折线图并且它有效。但是,当我尝试编辑嵌入式条形图时,我发现 CTBarChart.class 未在模式(org.openxmlformats.schemas.drawingxml.x2006.chart.CTBarChart.class)内部实现。

我想知道是否必须编写自己的 XML 解析器或查找不同的库,或者 CTBarChart 是否是 POI 内我未找到的另一个文件的一部分。

最佳答案

有一个Apache POI FAQ Entry在这个问题上!

引用常见问题解答中的重要部分:

There are two jar files available, as described in the components overview section. The full jar of all of the schemas is ooxml-schemas-1.1.jar, and it is currently around 15mb. The smaller poi-ooxml-schemas jar is only about 4mb. This latter jar file only contains the typically used parts though.

Many users choose to use the smaller poi-ooxml-schemas jar to save space. However, the poi-ooxml-schemas jar only contains the XSDs and classes that are typically used, as identified by the unit tests. Every so often, you may try to use part of the file format which isn't included in the minimal poi-ooxml-schemas jar. In this case, you should switch to the full ooxml-schemas-1.1.jar. Longer term, you may also wish to submit a new unit test which uses the extra parts of the XSDs, so that a future poi-ooxml-schemas jar will include them.

因此,短期内您需要从小 poi-ooxml-schemas jar 切换到完整的 ooxml-schemas jar。从长远来看,您需要向使用该类的 Apache POI 提交单元测试,因此它会自动包含在未来的小 jar 中

关于apache-poi - 在 POI 模式中找不到 CTBarChart,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26258917/

相关文章:

ms-access - 通过 VBA 连接 Powerpoint 和 Access?

git - Github 页面上的 Powerpoint 演示文稿

Python-pptx - Autoshape 上的文本参数(字体、大小、位置)

Java如何在Apache POI上进行搜索和替换时避免覆盖模板文件

java - Selenium + Apache POI + Java

java - 优化DOC、XLS文件中的元数据写入

perl - 使用 OLE 从 Powerpoint 中获取文本

excel - Apache POI - 生成引用其他单元格的条件格式

java - Apache POI 3.16 - 使用 XSSF 读取 75K 行 EXCEL (.xlsx) 时出现 OutOfMemory 异常

c# - 如果 Quit() 不起作用,则终止进程