Working with Comments and Speaker Notes — Aspose.Slides FOSS for .NET

This guide shows how to add and read threaded comments and speaker notes in PPTX presentations using Aspose.Slides FOSS for .NET. Two annotation types are supported: threaded slide comments (visible in review mode) and speaker notes (visible in Presenter View and the Notes pane).


Threaded Comments

Comments are attached to a slide and associated with an author. The prs.CommentAuthors collection manages all authors; each author has a Comments collection for adding and reading comments.

Add a Comment

Call prs.CommentAuthors.AddAuthor() to create an author, then call author.Comments.AddComment() with the slide, text, position, and timestamp:

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

using var prs = new Presentation();
// Create a comment author with initials
var author = prs.CommentAuthors.AddAuthor("Jane Smith", "JS");

var slide = prs.Slides[0];

// Add a comment at position (2.0, 2.0) inches from the slide top-left
author.Comments.AddComment(
    "Please review the figures on this slide",
    slide,
    new PointF(2.0f, 2.0f),
    DateTime.Now
);

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

The PointF position is in inches from the top-left corner of the slide. Multiple comments can be added to the same slide by calling AddComment() again.

Multiple Authors and Comments

Create separate authors for each reviewer and add independent comments from different authors to the same slide:

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

using var prs = new Presentation();
var author1 = prs.CommentAuthors.AddAuthor("Alice Brown", "AB");
var author2 = prs.CommentAuthors.AddAuthor("Bob Davis", "BD");

var slide = prs.Slides[0];

author1.Comments.AddComment("Initial draft", slide, new PointF(1.0f, 1.0f), DateTime.Now);
author2.Comments.AddComment("Approved", slide, new PointF(3.0f, 1.0f), DateTime.Now);

prs.Save("multi-author.pptx", SaveFormat.Pptx);

Read Comments from an Existing File

Iterate prs.CommentAuthors to access each author, then iterate author.Comments to read the comment text and slide reference:

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}");
    }
}

Speaker Notes

Speaker notes are stored on a per-slide basis via a NotesSlide object. Access it through slide.NotesSlideManager.

Add Speaker Notes to a Slide

Call slide.NotesSlideManager.AddNotesSlide() to create a notes slide, then set the text on notes.NotesTextFrame:

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

using var prs = new Presentation();
var slide = prs.Slides[0];
slide.Shapes.AddAutoShape(ShapeType.Rectangle, 50, 50, 400, 200);

// Create the notes slide and set text
var notes = slide.NotesSlideManager.AddNotesSlide();
notes.NotesTextFrame.Text = "Mention the Q3 revenue increase on this slide. Emphasize the 24% growth.";

prs.Save("with-notes.pptx", SaveFormat.Pptx);

Simpler Notes Example

The call to AddNotesSlide() works the same regardless of what shapes are on the slide — add one shape, then create the notes:

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

using var prs = new Presentation();
var slide = prs.Slides[0];
slide.Shapes.AddAutoShape(ShapeType.Rectangle, 100, 100, 500, 250).AddTextFrame("Main Content");

var notes = slide.NotesSlideManager.AddNotesSlide();
notes.NotesTextFrame.Text = "These are the speaker notes for this slide.";

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

Check Whether a Notes Slide Already Exists

NotesSlideManager.NotesSlide returns null if no notes slide has been created yet:

using Aspose.Slides.Foss;

using var prs = new Presentation("existing.pptx");
for (int i = 0; i < prs.Slides.Count; i++)
{
    var existingNotes = prs.Slides[i].NotesSlideManager.NotesSlide;
    if (existingNotes != null)
    {
        var text = existingNotes.NotesTextFrame.Text;
        Console.WriteLine($"Slide {i + 1} notes: {text[..Math.Min(60, text.Length)]}...");
    }
    else
    {
        Console.WriteLine($"Slide {i + 1}: no notes");
    }
}

Add Notes to Multiple Slides

Iterate prs.Slides and call AddNotesSlide() on each slide to attach a speaker note from an array of prepared text strings:

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

var noteTexts = new[]
{
    "Opening remarks: introduce the agenda.",
    "Key metrics: emphasize Q4 results.",
    "Closing: call to action.",
};

using var prs = new Presentation();
// Add slides 2 and 3
var layout = prs.Slides[0].LayoutSlide;
prs.Slides.AddEmptySlide(layout);
prs.Slides.AddEmptySlide(layout);

for (int i = 0; i < prs.Slides.Count; i++)
{
    prs.Slides[i].Shapes.AddAutoShape(ShapeType.Rectangle, 50, 50, 600, 300)
        .AddTextFrame($"Slide {i + 1}");
    var n = prs.Slides[i].NotesSlideManager.AddNotesSlide();
    n.NotesTextFrame.Text = noteTexts[i];
}

prs.Save("all-notes.pptx", SaveFormat.Pptx);

See Also

 English