Add Speaker Notes

This demo uses the DevExpress Presentation API to add or clear speaker notes in presentation slides. You can process the predefined sample file or upload your own presentation. To do the latter, select Upload a File in the file selection drop-down menu.

You specify the note text and slide number to add a new speaker note or clear all notes. Use the Modify Notes and Save as... dropdown button to select the output format, generate a presentation with speaker notes, and download the result.

Sample document
Sample.pptx



using DevExpress.Docs.Presentation;

Stream ApplyNotes(Stream input, NotesActionType action, string noteText, int slideIndex, DocumentFormat format) {
    using var presentation = new Presentation(input);

    switch(action) {
        case NotesActionType.ClearAllNotes:
            ClearAllNotes(presentation);
            break;
        case NotesActionType.AddNoteToSlide:
            AddUpdateNote(presentation, slideIndex, noteText);
            break;
    }
    var outputStream = new MemoryStream();

    presentation.SaveDocument(outputStream, format);

    outputStream.Position = 0;
    return outputStream;
}

void AddUpdateNote(Presentation presentation, int slideIndex, string noteText) {
    if(slideIndex >= 0 && slideIndex < presentation.Slides.Count) {
        var slide = presentation.Slides[slideIndex];
        if(presentation.NotesMaster == null)
            presentation.NotesMaster = new NotesMaster(name: "notesMaster");
        NotesSlide notes;
        if(slide.Notes == null) {
            notes = new NotesSlide();
            slide.Notes = notes;
        } else
            notes = slide.Notes;
        notes.TextArea.Text = noteText;
    }
}

void ClearAllNotes(Presentation presentation) {
    foreach(var slide in presentation.Slides)
        slide.Notes = null;
}