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

These classes manage slide-level comments and their authors. Access comment authors via Presentation.CommentAuthors and per-slide comments via Slide.GetSlideComments().

Package: Aspose.Slides.Foss (net9.0)

using Aspose.Slides.Foss;

Comment

public class Comment : IComment

Properties

PropertyTypeAccessDescription
TextstringReadComment text.
CreatedTimeDateTime?ReadWhen the comment was created.
SlideISlideReadSlide the comment belongs to.
AuthorICommentAuthorReadAuthor of the comment.
PositionPointFReadPosition on the slide.
ParentCommentIComment?ReadParent comment for threaded replies.

Methods

MethodDescription
Remove()Remove this comment.

CommentAuthor

public class CommentAuthor : ICommentAuthor

Properties

PropertyTypeAccessDescription
NamestringReadAuthor display name.
InitialsstringReadAuthor initials.
CommentsICommentCollectionReadAll comments by this author.

Methods

MethodDescription
Remove()Remove this author and their comments.

CommentAuthorCollection

Accessed via Presentation.CommentAuthors.

public class CommentAuthorCollection : ICommentAuthorCollection

Properties

PropertyTypeAccessDescription
CountintReadNumber of authors.

Methods

MethodReturnsDescription
AddAuthor(string name, string initials)ICommentAuthorAdd a new comment author.
FindByName(string name)ICommentAuthor[]Find authors by name.
FindByNameAndInitials(string name, string initials)ICommentAuthor[]Find by name and initials.
RemoveAt(int index)voidRemove the author at the specified index.
Remove(ICommentAuthor author)voidRemove a specific author.
Clear()voidRemove all authors.
ToArray()ICommentAuthor[]Return all authors as an array.

CommentCollection

Accessed via CommentAuthor.Comments.

public class CommentCollection : ICommentCollection

Properties

PropertyTypeAccessDescription
CountintReadNumber of comments.

Methods

MethodReturnsDescription
AddComment(string text, ISlide slide, PointF position, DateTime creationTime)ICommentAdd a comment to a slide.
InsertComment(int index, string text, ISlide slide, PointF position, DateTime creationTime)ICommentInsert a comment at a specific index.
FindCommentByIdx(int idx)ICommentFind a comment by index.
RemoveAt(int index)voidRemove comment at index.
Remove(IComment comment)voidRemove a specific comment.
Clear()voidRemove all comments.
ToArray()IComment[]Return all comments as an array.

Usage Examples

Add a Comment

using Aspose.Slides.Foss;
using Aspose.Slides.Foss.Export;

using var prs = new Presentation();
var author = prs.CommentAuthors.AddAuthor("Reviewer", "R");
author.Comments.AddComment(
    "Looks good!",
    prs.Slides[0],
    new PointF(100, 100),
    DateTime.Now);

prs.Save("commented.pptx", SaveFormat.Pptx);

Read Comments

using Aspose.Slides.Foss;

using var prs = new Presentation("commented.pptx");
foreach (var author in prs.CommentAuthors)
{
    Console.WriteLine($"Author: {author.Name} ({author.Initials})");
    foreach (var comment in author.Comments)
    {
        Console.WriteLine($"  [{comment.Slide.SlideNumber}] {comment.Text}");
    }
}

See Also