PPT PPTX ODP POT PPSX
Aspose.Slides  for Java
PPT

Search Text in PPT using Java

Build Java applications that search text in presentation files using server-side APIs.

Search Text in PPT Presentation via Java

Using Aspose.Slides for Java , you can search text in PPT presentations. Use the SlideUtil.getAllTextBoxes method to collect text frames and then inspect ITextFrame, IParagraph, and IPortion objects.

Search Text in PPT Presentation using Java

Presentation presentation = new Presentation("welcome-to-powerpoint.ppt");
try {
    String searchText = "PowerPoint";

    for (ISlide slide : presentation.getSlides()) {
        ITextFrame[] slideTextFrames = SlideUtil.getAllTextBoxes(slide);

        for (ITextFrame textFrame : slideTextFrames) {
            for (IParagraph paragraph : textFrame.getParagraphs()) {
                for (IPortion portion : paragraph.getPortions()) {
                    if (portion.getText().contains(searchText)) {
                        System.out.println(portion.getText());
                    }
                }
            }
        }
    }
} finally {
    presentation.dispose();
}

How to Search Text in PPT via Java

These are the steps to search text in PPT files.

  1. Load the PPT file with the Presentation class.

  2. Call the SlideUtil.getAllTextBoxes method to collect text frames from each slide.

  3. Inspect ITextFrame, IParagraph, and IPortion objects to find matching text.

Online PPT Search Live Demos