Removing Comments From Word



Comments are used in word documents, DOCX or DOC, for suggesting improvements and modifications. Let us explore how to insert comments as well as deleting or removing comments programmatically using Java. You can add author name, initials, comment text, date, and time based on your requirements. We will be performing all of these tasks using Aspose.Words for Java API.

Open the folder contains the Word document which you will remove the timestamp from the existing comments. Make sure the File name extensions box is checked, then, right click the file and select Rename option, change extension of the Word document from “.docx ” to “.zip ”, then press the Enter key. When working with a word document, you can add comments as feedback. A timestamp will display following the author's name in the comment balloons. If you want to remove the timestamps from the comment balloons, please follow the steps below. Removing comments from SMS course syllabi.

How to print word document without comments

Here we will be learning following use cases related to comments in word documents:

Insert or Delete Comments in Word files (DOCX/DOC) API – Installation

Removing Comments From Word

You can download the latest version of Aspose.Words for Java API from Downloads section or from Maven repository, as per the configurations mentioned below:

Repository

Dependency

So the API has been configured now and we can proceed to explore different use cases of working with comments in Word documents.

Insert Comment in Existing Word Document using Java

Word

You can insert or add comments in existing Microsoft Word files, DOCX or DOC, with Aspose.Words for Java API. This can be helpful when reviewing documents, like a supervisor can suggest several changes or improvements on a feasibility report. Moreover, anyone with edit permissions of a word document can work with comments. You need to follow the steps below to insert comments in word file (DOCX/DOC):

  1. Load existing DOCX file with Document class
  2. Create a comment
  3. Save DOCX file

Word Remove Comment Pane

The following code snippet shows how to insert a comment in Word document using Java:

Word
View the code on Gist.

Below screenshot shows a sample comment added in existing Word documents:

Removing Comments From Word Doc

Insert Comment in new Word Document using Java

Comments are also helpful when creating a new word document. For instance, some text may need elaboration which can be explained with the help of comment. Likewise, there could be hundreds of use cases where comments can assist while creating a new DOCX file. You can easily add or insert comments by following the steps below:

  1. Initialize DocumentBuilder object
  2. Add sample text
  3. Create a custom comment
  4. Save DOCX file

The code snippet below shows how to insert comments while creating a new word document from scratch, using Java:

View the code on Gist.

The screenshot below shows the output where the comment is added on new word document:

Delete Specific Comments from Word Document using Java

Comments are often deleted when suggested improvements or modifications are incorporated into the word document. When you need to delete specific comments then you can follow the steps below:

  1. Load source word document
  2. Specify author name
  3. Remove comments from the specified author

The code snippet below shows how to delete specific comments from word file using Java:

Remove Comments From Word Doc

View the code on Gist.

Delete All Comments from Word Documents using Java

Comment

All comments of Word document can be deleted at once. Ultra fine paint brush. You can follow the steps below for removing all comments:

  1. Open word docx file
  2. Collect all comments in the file
  3. Delete all comments

Following code snippet elaborates how to delete all comments from Word documents using Java:

View the code on Gist.

Conclusion

To sum up, we have learned how to add, insert, delete, or remove comments from word documents programmatically with Java. If you have any doubts or confusion then please contact us at Free Support Forum.

Removing Comments Section From Word

See Also