In this quick guide you’ll learn how to Java Words API read comments from a DOCX [DOCX file info] document using the Aspose.Words Cloud REST service.
Prerequisite
- Create an account and get API credentials to access the comments in the DOCX file
- Download the Aspose.Words Cloud SDK for Java to read the comments in a Word file
- Set up a Java project and add the SDK to retrieve DOCX comments
Steps to load Word DOC comments with Java REST API
- Set Client ID and Client Secret for the API to access the comments in a Word file.
- Instantiate an instance of the WordsApi class with your client account credentials.
- Create a request to read the comments using an instance of GetCommentOnlineRequest by providing the file name and comment index.
- Access the Comment in the Word document online using the GetCommentOnline method.
- The required comment will be returned and displayed in the console.
The steps above describe how to access Word documents online with the Java REST API. First, initialise the WordsApi object with your clientId and clientSecret, then build a GetCommentOnlineRequest with the document name and comment index. Finally, call GetCommentOnline() to obtain a Comment object that you can process further.
Code to read DOCX comments with Java Low Code API
This example demonstrates how to read DOCX comments with the Java REST API. The GetCommentOnlineRequest requires the document name and comment index and optionally allows you to specify load encoding, password, and encryption password. The response from GetCommentOnline() returns a Comment object containing details such as comment text, author name, author initials, and comment time.
If you need to delete Word DOC comments, see the article on Delete Comments in Word DOC with Java REST API.
Keywords: read Comments in Word Document with NET REST API; access word documents online with Java REST API; read docx comments with NET REST API; load a word document comments with Java Low Code API.