Comment / CommentAuthor — Aspose.Slides FOSS for Java API Reference

The Comment and CommentAuthor classes represent slide comments and their authors. They implement IComment and ICommentAuthor respectively.

Package: org.aspose.slides.foss

import org.aspose.slides.foss.*;

Comment

public class Comment implements IComment

Constructor

SignatureDescription
Comment(String text, ICommentAuthor author, ISlide slide, PointF position, LocalDateTime createdTime)Create a new comment.

Properties

PropertyTypeAccessDescription
getText() / setText(String)StringRead/WriteComment text.
getAuthor()ICommentAuthorReadThe comment author.
getSlide()ISlideReadSlide this comment is on.
getPosition()PointFReadPosition on the slide.
getCreatedTime()LocalDateTimeReadCreation timestamp.
getParentComment()Optional<IComment>ReadParent comment for replies.
setParentComment(IComment)voidWriteSet parent comment.

Methods

MethodReturnsDescription
remove()voidRemove this comment.

CommentAuthor

public class CommentAuthor implements ICommentAuthor

Constructor

SignatureDescription
CommentAuthor(String name, String initials, int id)Create a new comment author.

Properties

PropertyTypeDescription
getName()StringAuthor name.
getInitials()StringAuthor initials.
getId()intAuthor identifier.
getComments()ICommentCollectionComments by this author.

Usage Examples

Add a Comment to a Slide

import org.aspose.slides.foss.*;
import java.time.LocalDateTime;

Presentation prs = new Presentation();
ICommentAuthorCollection authors = prs.getCommentAuthors();
ICommentAuthor author = authors.addAuthor("John", "J");

ISlide slide = prs.getSlides().get(0);
slide.getSlideComments(null); // read existing comments

// Add comment via the author's comment collection
author.getComments().addComment(
    "Review this slide", slide, new PointF(100, 100), LocalDateTime.now());

prs.save("commented.pptx", SaveFormat.PPTX);

See Also