This guide shows how to Aspose.Words Java developers can insert comments into a DOCX document using the Aspose.Words Cloud Java REST API.
Prerequisite
- Create an account and get API credentials to insert comments in the DOCX file
- Download Aspose.Words Cloud SDK for Java to include comments in a Word file
- Set up a Java project with the above SDK to add the DOCX comments
Steps to Insert Comments into Word Document with Java REST API
- Set Client ID and Client Secret for the API to add comments in a Word file
- Create an instance of the WordsApi class with your client account credentials
- Create an instance of CommentInsert by providing the comment start and end range
- Create a request to add comments using an instance of InsertCommentOnlineRequest by providing the file name
- Insert the Comments in the Word document online using the InsertComment method
- Download the generated file from the cloud using the stream inside the response’s Documents dictionary
- Save the downloaded file stream as a DOCX file on the disk
Code to Add Comments in Word Document with Java REST API
The sample demonstrates how to create comments in a DOCX file with the Java Low‑Code API. The CommentInsert class exposes properties to set the range for comment start and end, comment initials, author, and text. You can add multiple comments inside the document. The file name supplied to the InsertCommentOnlineRequest is used to extract the corresponding document stream from the response object.
In this article we covered how to add comments to a Word document using the Java REST API. To learn how to create a new Word document, see the article on how to create a Word file with Java REST API.
Keywords: insert comments in DOCX with NET REST API; insert comments into Word Document with NET REST API; add a Comment into Word Document with Java Low Code API; create comments in docx with Java Low Code API; add comments in word document with NET REST API; Add MS Word comments with java Rest API.