Search Documents for Text with NET REST API

In this guide we’ll demonstrate how to WordsApi and SearchOnline to locate specific text inside a DOCX file using the Aspose.Words Cloud Java SDK, returning detailed information about each occurrence in the source Word document.

Prerequisite

Steps to Search for Text in Word Documents with Java REST API

  1. Create the WordsApi object by providing the client ID and secret.
  2. Load the sample Word file and store it in a memory stream.
  3. Create a SearchOnlineRequest object, initialize it with the input file, and specify the text to search.
  4. Call the SearchOnline method and pass the request object.
  5. Iterate through the ResultsList returned by the search operation and display the results on the console.

The steps above outline how to find text in a document using the Java REST API. Begin by instantiating the WordsApi object and loading the source Word file into a stream, then create a SearchOnlineRequest to use as the argument for the SearchOnline call.

Code to Find Text in a Document with Java REST API

This sample demonstrates how to search for text in Word documents with the Java REST API. The SearchOnline() method returns a results list containing the matched text and node information where the text appears. You can iterate through the collection to display details such as the search string usage and its location in the document.

In this topic, we covered the process of searching text in a Word file. To learn how to create a table, see the article: Create Table in Word with Java REST API.

Keywords: find word in text online with Java Low Code API; search documents for text with NET REST API; find text in a document with NET REST API; find text in document with Java REST API; how to search text in word documents with Java REST API.