简体   繁体   English

如何使用apache poi从ppt,pptx文件(页脚,幻灯片编号)中提取文本?

[英]how to extract text from ppt, pptx file except footer, slide number using apache poi?

I know how to extract text from ppt file using apache poi like this 我知道如何使用apache poi从ppt文件中提取文本

        InputStream fis=new FileInputStream("abcd.ppt");
        HSLFSlideShow show=new HSLFSlideShow(fis);
        SlideShow ss=new SlideShow(show);
        Slide[] slides=ss.getSlides();
        StringBuilder builder = new StringBuilder();
        for(int x=0; x < slides.length; x++)
        {
            TextRun[] runs = slides[x].getTextRuns();
            for(int j=0; j<runs.length; j++) {
                TextRun run = runs[j];
                if(run != null) {
                    String text = run.getText();
                    builder.append(text);
                }
            }
        }

but it extracts all footer, slide number that I don't want 但它会提取我不需要的所有页脚,幻灯片编号

So how to extract text except footer and slide number 那么如何提取除页脚和幻灯片编号以外的文本

Thanks in advance 提前致谢

I would recommend that you look at the JPresentation. 我建议您看一下JPresentation。 One of their examples shows how to extract all images and text from all slides: http://www.independentsoft.de/jpresentation/tutorial/exportallslides.html 他们的示例之一显示了如何从所有幻灯片中提取所有图像和文本: http : //www.independentsoft.de/jpresentation/tutorial/exportallslides.html

The API seams to be very easy. API的接缝非常简单。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM