Comment, CommentAuthor, CommentCollection — Aspose.Slides FOSS for Python API Reference

Aspose.Slides FOSS supports threaded slide comments. Authors are registered at the presentation level; each author can attach Comment objects to individual slides.

Package: aspose.slides_foss


CommentAuthorCollection

Access via prs.comment_authors.

Properties

PropertyTypeAccessDescription
__len__intReadNumber of registered comment authors.

Methods

MethodSignatureDescription
add_authoradd_author(name, initials) -> CommentAuthorRegister a new author and return the CommentAuthor object.
find_by_namefind_by_name(name) -> CommentAuthorReturn the author with the given name, or None.
remove_authorremove_author(author)Remove an author and all their comments from the presentation.
__getitem__comment_authors[i]Return the author at zero-based index i.
__iter__for a in comment_authorsIterate authors.

CommentAuthor

Represents a named person who writes comments.

Properties

PropertyTypeAccessDescription
namestrRead/WriteDisplay name of the author.
initialsstrRead/WriteShort initials shown in the comment bubble.
commentsCommentCollectionReadAll comments written by this author across the presentation.

CommentCollection

Collection of Comment objects belonging to an author. Access via author.comments.

MemberSignatureDescription
add_commentadd_comment(text, slide, position, created_time) -> CommentAdd a new comment at position (PointF) on the given slide, timestamped with created_time (datetime).
insert_commentinsert_comment(index, text, slide, position, created_time) -> CommentInsert a comment at a specific index in the collection.
__getitem__comments[i]Return the Comment at zero-based index i.
__len__len(comments)Number of comments.
__iter__for c in commentsIterate comments.

Comment

A single comment attached to a slide position.

Properties

PropertyTypeAccessDescription
textstrRead/WritePlain text content of the comment.
created_timedatetimeRead/WriteTimestamp when the comment was created (UTC).
positionPointFRead/WritePosition of the comment anchor on the slide, in points from the top-left corner.
slideISlideReadThe slide this comment belongs to.
authorCommentAuthorReadThe author who wrote this comment.
parent_commentComment or NoneRead/WriteParent comment for threaded replies. None if this is a top-level comment.

Methods

MethodSignatureDescription
removeremove()Remove this comment and all its direct replies from the slide. Changes are persisted immediately.

ModernComment

ModernComment (PPTX modern comment type) shares the same interface as Comment and is returned for slides that use the modern comment XML format. Use it identically.


Usage Example

Add comments and read them back

from datetime import datetime, timezone
import aspose.slides_foss as slides
from aspose.slides_foss import ShapeType
from aspose.slides_foss.drawing import PointF
from aspose.slides_foss.export import SaveFormat

with slides.Presentation() as prs:
    slide = prs.slides[0]

    # Add a shape
    shape = slide.shapes.add_auto_shape(ShapeType.RECTANGLE, 100, 100, 400, 80)
    shape.add_text_frame("Slide content")

    # Register an author
    author = prs.comment_authors.add_author("Jane Smith", "JS")

    # Add a top-level comment
    ts = datetime(2025, 6, 1, 10, 0, 0, tzinfo=timezone.utc)
    comment = author.comments.add_comment(
        "Please update the chart data before the meeting.",
        slide,
        PointF(150.0, 120.0),
        ts,
    )

    # Add a reply
    reply_ts = datetime(2025, 6, 1, 11, 30, 0, tzinfo=timezone.utc)
    reply = author.comments.add_comment(
        "Done — data refreshed from Q2 report.",
        slide,
        PointF(150.0, 120.0),
        reply_ts,
    )
    reply.parent_comment = comment

    prs.save("comments-demo.pptx", SaveFormat.PPTX)


# Reading comments back
with slides.Presentation("comments-demo.pptx") as prs:
    for author in prs.comment_authors:
        print(f"Author: {author.name}")
        for c in author.comments:
            parent_info = f" (reply to: {c.parent_comment.text[:20]}...)" if c.parent_comment else ""
            print(f"  [{c.created_time}] {c.text}{parent_info}")

See Also