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

Aspose.Slides FOSS for .NET supports two types of annotations: 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

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

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

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

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

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

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