Java Words API makes it easy to programmatically remove comment sections from Word documents such as DOC and DOCX using the Aspose.Words Cloud SDK for Java. This article walks you through the required setup and provides a concise code example to delete comments from a Word file via the Java REST API.
Prerequisite
- Create an account and get API credentials to remove comments in the DOC file
- Download Aspose.Words Cloud SDK for Java to delete comments in a Word file
- Set up a Java project with the above SDK to clear the DOCX comments
Steps to Remove Comments from Word Document with Java REST API
- Set Client ID and Client Secret for the API to delete comments in a Word file.
- Create an instance of the WordsApi class with your client account credentials.
- Create a request to delete comments using an instance of DeleteCommentsOnlineRequest by providing the file name.
- Remove the Comments in the Word document online using the DeleteCommentsOnline operation.
- Download the generated file from the cloud using the stream inside the response dictionary that contains a file stream.
- Save the downloaded file stream with deleted comments as a DOCX file on the disk.
The steps above illustrate how to remove comments from a Word document with Java REST API: instantiate WordsApi with your clientId and clientSecret, build a DeleteCommentsOnlineRequest with the source document name, and invoke DeleteCommentsOnline to clear all comments. The response returns a stream containing the updated DOCX file, which you can save locally or process further.
Code to Delete Comments in Microsoft Word with Java Low Code API
This sample demonstrates how to delete comments on DOCX with Java REST API. The DeleteCommentsOnlineRequest class lets you specify the source document, target document name, password, encrypted password, revision number, and revision date‑time, among other options. When DeleteCommentsOnline is called, all comments are removed and the resulting DOCX file stream is returned in the response.
In this topic, you learned to delete comments in Microsoft Word with Java Low Code API. If you need to insert comments in a Word document, see the article on Insert comments in DOCX with Java REST API.
Keywords: remove comments from word document with NET REST API; Delete Comments in Word DOC with NET REST API; clear comments from docx with Java Low Code API; 1 “delete comments in microsoft word with Java Low Code API; remove comments section from word with Java Low Code API; delete comments on docx with NET REST API.