Search text in Microsoft Office PowerPoint presentations

View as MarkdownMarkdown

Set up your AI agent

Give your coding agent live access to the GroupDocs documentation and API reference through the GroupDocs Docs MCP server — no install, no API key. Learn more

claude mcp add --transport http groupdocs-docs https://docs.groupdocs.com/mcp

Also process documents locally

The GroupDocs.Parser MCP server lets your agent work with files on your machine; they are never uploaded. It needs the .NET 10 SDK or Docker.

claude mcp add groupdocs-parser -- dnx GroupDocs.Parser.Mcp --yes
Folders, licensing and more →

To search a keyword in Microsoft Office PowerPoint presentations search(String) method is used. This method returns the collection of SearchResult objects. For details, see Search Text.

Here are the steps to search a keyword in Microsoft Office PowerPoint presentation:

  • Instantiate Parser object for the initial presentation;
  • Call search(String) method and obtain the collection of SearchResult objects;
  • Iterate through the collection and get the position and text.
Warning
search(String) method returns null value if search isn’t supported for the presentation. For example, text extraction isn’t supported for Zip archive. Therefore, for Zip archive search(String) method returns null. For empty Microsoft Office PowerPoint presentation search(String) method returns an empty collection.

The following example shows how to find a keyword in Microsoft Office PowerPoint presentation:

// Create an instance of Parser class
try (Parser parser = new Parser(Constants.SamplePptx)) {
    // Search a keyword:
    Iterable<SearchResult> sr = parser.search("Age");
    // Iterate over search results
    for (SearchResult s : sr) {
        // Print an index and found text:
        System.out.println(String.format("At %d: %s", s.getPosition(), s.getText()));
    }
}

search(String, SearchOptions) method is used for the advanced search in Microsoft Office PowerPoint presentations - like search with regular expressions, search by pages etc. SearchOptions parameter is used to customize a search.

Here are the steps to search with a regular expression in Microsoft Office PowerPoint presentation:

The following example shows how to search with a regular expression in Microsoft Office PowerPoint presentation:

// Create an instance of Parser class
try (Parser parser = new Parser(Constants.SamplePptx)) {
    // Search with a regular expression with case matching
    Iterable<SearchResult> sr = parser.search("[0-9]+", new SearchOptions(true, false, true));
    // Iterate over search results
    for (SearchResult s : sr) {
        // Print an index and found text:
        System.out.println(String.format("At %d: %s", s.getPosition(), s.getText()));
    }
}

More resources

GitHub examples

You may easily run the code above and see the feature in action in our GitHub examples:

Free online document parser App

Along with full featured .NET library we provide simple, but powerful free Apps.

You are welcome to parse documents and extract data from PDF, DOC, DOCX, PPT, PPTX, XLS, XLSX, Emails and more with our free online Free Online Document Parser App.