How to Add Comments to PowerPoint in Python

How to Add Comments to PowerPoint in Python

This guide shows how to add comments and speaker notes to PowerPoint slides using Aspose.Slides FOSS for Python. Use prs.comment_authors.add_author() to create an author, then call author.comments.add_comment() to attach threaded comments to a slide. Use slide.notes_slide_manager.add_notes_slide() to add per-slide speaker notes.


Prerequisites

Install the library in your Python environment by running the following pip command before running any examples:

pip install aspose-slides-foss

Add a Comment

Comments belong to an author object. Create an author first, then add comments through author.comments:

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

with slides.Presentation() as prs:
    # Create a comment author with name and initials
    author = prs.comment_authors.add_author("Jane Smith", "JS")

    slide = prs.slides[0]

    # Add a comment at (2.0, 2.0) inches from the slide top-left corner
    author.comments.add_comment(
        "Please review the figures on this slide",
        slide,
        PointF(2.0, 2.0),
        datetime.now(),
    )

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

The PointF coordinates are in inches from the top-left of the slide. Multiple calls to add_comment() create a threaded comment chain under the same author.


Multiple Authors and Comments

Create multiple authors with prs.comment_authors.add_author() and attach separate comments from each:

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

with slides.Presentation() as prs:
    author1 = prs.comment_authors.add_author("Alice Brown", "AB")
    author2 = prs.comment_authors.add_author("Bob Davis", "BD")

    slide = prs.slides[0]

    author1.comments.add_comment(
        "Initial draft: needs revision",
        slide, PointF(1.0, 1.0), datetime.now()
    )
    author2.comments.add_comment(
        "Approved after changes",
        slide, PointF(3.0, 1.0), datetime.now()
    )

    prs.save("multi-author.pptx", SaveFormat.PPTX)

Read Comments from an Existing File

Load the file into a Presentation, iterate prs.comment_authors, and for each author iterate author.comments to read the text and slide reference:

import aspose.slides_foss as slides

with slides.Presentation("commented.pptx") as prs:
    for author in prs.comment_authors:
        print(f"Author: {author.name} ({author.initials})")
        for comment in author.comments:
            print(f"  Slide {comment.slide.slide_number}: {comment.text}")

Add Speaker Notes to a Slide

Speaker notes are added by calling slide.notes_slide_manager.add_notes_slide(), then writing text to notes.notes_text_frame.text:

from aspose.slides_foss import ShapeType
import aspose.slides_foss as slides
from aspose.slides_foss.export import SaveFormat

with slides.Presentation() as prs:
    slide = prs.slides[0]
    slide.shapes.add_auto_shape(
        ShapeType.RECTANGLE, 50, 50, 600, 300
    ).add_text_frame("Main slide content")

    # Create the notes slide and write text
    notes = slide.notes_slide_manager.add_notes_slide()
    notes.notes_text_frame.text = (
        "Mention the Q3 revenue increase. Emphasize the 24% YoY growth."
    )

    prs.save("with-notes.pptx", SaveFormat.PPTX)

Add Notes to Multiple Slides

Iterate over prs.slides and call slide.notes_slide_manager.add_notes_slide() for each slide to attach a note in one pass:

from aspose.slides_foss import ShapeType
import aspose.slides_foss as slides
from aspose.slides_foss.export import SaveFormat

note_texts = [
    "Opening: introduce the agenda and set expectations.",
    "Key metrics: emphasize Q4 results and growth trajectory.",
    "Closing: summarize and call to action.",
]

with slides.Presentation() as prs:
    layout = prs.slides[0].layout_slide
    prs.slides.add_empty_slide(layout)
    prs.slides.add_empty_slide(layout)

    for i, slide in enumerate(prs.slides):
        slide.shapes.add_auto_shape(
            ShapeType.RECTANGLE, 50, 50, 600, 300
        ).add_text_frame(f"Slide {i + 1}")

        n = slide.notes_slide_manager.add_notes_slide()
        n.notes_text_frame.text = note_texts[i]

    prs.save("all-notes.pptx", SaveFormat.PPTX)

Check Whether Notes Already Exist

notes_slide_manager.notes_slide returns None if no notes slide has been created:

import aspose.slides_foss as slides

with slides.Presentation("existing.pptx") as prs:
    for i, slide in enumerate(prs.slides):
        existing = slide.notes_slide_manager.notes_slide
        if existing:
            print(f"Slide {i + 1}: {existing.notes_text_frame.text[:60]}")
        else:
            print(f"Slide {i + 1}: no notes")

See Also

 English