This topic entails the process to Delete comments in Word DOC with NET REST API. We will use Aspose.Words for .NET Cloud SDK to remove comments section from Word with C# Low Code API. The topic covers all the required details to set the development environment and easy-to-use example code.
Prerequisite
- Create an account and get API credentials to remove comments in the DOC file
- Download Aspose.Words Cloud SDK for Dotnet to delete comments in a Word file
- Setup C# solution project with the above SDK to clear the DOCX comments
Steps to Remove Comments from Word Document with NET 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 add comments using an instance of the DeleteCommentsOnlineRequest by providing the file name
- Remove the Comments in the Word document online using the DeleteCommentsOnline object
- Download the generated file from the cloud using the stream inside the response dictionary having a file stream
- Save the downloaded file stream with deleted comments as a DOCX file on the disk
The above-mentioned steps explain the mechanism to remove comments from Word document with NET REST API where the process will commence by creating an instance of the WordsApi class using the ClientSecret and ClientId, creating the DeleteCommentsOnlineRequest with the file name, and finally clearing all the comments from the document using the DeleteCommentsOnline method. Once the comments are removed, a response stream having a DOCX file with removed comments will be returned that can be saved on the disk as a file or used further in the application.
Code to Delete Comments in Microsoft Word with C# Low Code API
This sample code demonstrates the use case to delete comments on DOCX with NET REST API. The DeleteCommentsOnlineRequest class instance exposes different options to set the source document, target document file name, password, encrypted password, revision number and revision date time to name a few. Once the DeleteCommentsOnline is called, the comments get deleted from the document and the output DOCX file stream is returned as a response.
In this topic, we have learned to delete comments in Microsoft Word with C# Low Code API. If you are looking to insert comments in a Word document, the DOC file to a PD, refer to the article on insert Comments in DOCX with NET REST API.