Add or Remove Comments in PowerPoint PPT in Java

Add or Remove Comments in PowerPoint PPT in Java

In PowerPoint presentations, the comments are used to write the feedback about the content in the slides. While manipulating PowerPoint PPT/PPTX presentations, you may need to add comments programmatically. In this article, you will learn how to add comments to PowerPoint PPT slides in Java. Moreover, we will cover how to read or remove slide comments and add their replies.

Java API to Work with Comments in PowerPoint

Aspose.Slides for Java is a popular presentation manipulation API that lets you create and modify PowerPoint PPT/PPTX files. We will use this API to manipulate comments in PowerPoint presentations. You can either download API’s JAR or install it using the following Maven configurations.

Repository:
<repository>
    <id>AsposeJavaAPI</id>
    <name>Aspose Java API</name>
    <url>https://repository.aspose.com/repo/</url>
</repository>

Dependency:
<dependency>
    <groupId>com.aspose</groupId>
    <artifactId>aspose-slides</artifactId>
    <version>22.2</version>
    <classifier>jdk16</classifier>
</dependency>

Add Comments to PowerPoint PPT Slides in Java

In PowerPoint presentations, every comment is attached to a particular author. Whereas, each comment contains some additional information such as time of creation, slide where it is added, and its position. The following are the steps to add comments to a PPT slide in Java.

The following code sample shows how to add comments to PPT slides in Java.

The following is the screenshot of the comment we have added using the above code sample.

Insert Comments to PPT Slides in Java

Add Comment Replies in PPT Slides in Java

Aspose.Slides also allows you to add replies to the comments. A reply itself is a comment which appears as a child of an existing comment. So let’s see how to add replies to comments in PowerPoint PPT slides in Java.

The following code sample shows how to add replies to comments in a PPTX presentation in Java.

The following screenshot shows the output of the above code sample.

Add reply to the comments in PPT in Java

Read Comments in PPT Slides in Java

Using Aspose.Slides, you can also read comments of a particular author or all the authors. The following are the steps to read comments in PPT slides in Java.

The following code sample shows how to read comments in PPT slides in Java.

Remove Comments from PowerPoint PPT in Java

In the previous section, you have seen how to read a comment by accessing it from the comments collection. Similarly, you can remove a comment after getting its reference. The following code sample shows how to remove comments in PowerPoint presentations in Java.

Get a Free License

You can use Aspose.Slides for Java without evaluation limitations by requesting a temporary license.

Conclusion

In this article, you have learned how to add comments in PowerPoint PPT slides in Java. Moreover, we have covered how to add replies to the comments programmatically. In the end, we have demonstrated how to read or remove comments from PPT slides. You can visit the documentation to explore more about Aspose.Slides for Java. Also, you can post your queries to our forum.

See Also