I have added one smart art shape in the Microsoft power point presentation slide. I want to get the data of that diagram in Java using apache POI.
我在Microsoft powerpoint演示幻灯片中添加了一个智能艺术形状。我想使用apache POI在Java中获取该图的数据。
How to retrieve the complete data.xml from first slide of presentation. I opened the presentation and following is the hierarchy of presentation.
如何从演示文稿的第一张幻灯片中检索完整的data.xml。我打开了演示文稿,以下是演示文稿的层次结构。
I want to retrieve the data from first slide smart art diagram in XML ( complete data1.xml )
我想从XML中的第一张幻灯片智能艺术图中检索数据(完整的data1.xml)
Following is the code for getting first slide i have developed so far.
以下是我到目前为止开发的第一张幻灯片的代码。
public static void main(String[] args) {
// TODO Auto-generated method stub
final String filename = "resources/fptbenchmark/Powerpoint Import.pptx";
try {
XMLSlideShow ppt = new XMLSlideShow(new FileInputStream(filename));
ppt.getSlides()[0]. //here first slide
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
1 个解决方案
#1
0
Assuming you know you'll always want /ppt/diagrams/data1.xml
, then your code would want to continue with:
假设你知道你总是想要/ppt/diagrams/data1.xml,那么你的代码会希望继续:
OPCPackage pkg = ppt.getPackage();
PackagePart data1 = pkg.getPart(
PackagingURIHelper.createPartName("/ppt/diagrams/data1.xml"));
InputStream data1Inp = data1.getInputStream();
Then pass that InputStream to your XML parsing code to process
然后将该InputStream传递给您的XML解析代码进行处理
If you need to find the part dynamically based on the slide, you'll want to check the Relationships defined on your Slide part, and go from there
如果您需要根据幻灯片动态查找零件,您需要检查幻灯片部件上定义的关系,然后从那里开始
#1
0
Assuming you know you'll always want /ppt/diagrams/data1.xml
, then your code would want to continue with:
假设你知道你总是想要/ppt/diagrams/data1.xml,那么你的代码会希望继续:
OPCPackage pkg = ppt.getPackage();
PackagePart data1 = pkg.getPart(
PackagingURIHelper.createPartName("/ppt/diagrams/data1.xml"));
InputStream data1Inp = data1.getInputStream();
Then pass that InputStream to your XML parsing code to process
然后将该InputStream传递给您的XML解析代码进行处理
If you need to find the part dynamically based on the slide, you'll want to check the Relationships defined on your Slide part, and go from there
如果您需要根据幻灯片动态查找零件,您需要检查幻灯片部件上定义的关系,然后从那里开始