Use PowerPoint slide notes in C# and VB.NET

Notes are special slides that can be associated with a presentation slide to provide notes for the presenter.

By default, when notes slide is added to a presentation slide, it automatically contains several placeholder shapes that are inherited from the master notes slide. The placeholder shape with placeholder type PlaceholderType.Text is the shape that contains notes text (paragraphs).

For more information about notes slides and master notes slide, see the GemBox.Presentation content model help page.

The following C# and VB.NET example shows how to add notes to the slide using the GemBox.Presentation API.

Screenshot
PowerPoint Library for C# / VB.NET Screenshot

See the full code below, use Run Example to execute.

using System;
using System.IO;
using System.Linq;
using GemBox.Presentation;
using GemBox.Presentation.Media;

class Sample
{
    [STAThread]
    static void Main(string[] args)
    {
        // If using Professional version, put your serial key below.
        ComponentInfo.SetLicense("FREE-LIMITED-KEY");

        PresentationDocument presentation = new PresentationDocument();

        // Add a blank slide to the presentation.
        Slide slide = presentation.Slides.AddNew(SlideLayoutType.Blank);

        // Add a text box with some content to the slide.
        TextBox text = slide.Content.AddTextBox(3, 2, 22, 2, LengthUnit.Centimeter);
        text.AddParagraph().AddRun("This is my presentation with notes");

        // Add notes to the slide.
        NotesSlide notes = slide.AddNotes();

        // Using LINQ, find shape that contains notes text.
        TextBox notesText = notes.Content.Drawings.OfType<Shape>().
            Single(sp => sp.Placeholder.PlaceholderType == PlaceholderType.Text).Text;

        // Start adding notes text and formatting.
        notesText.AddParagraph().AddRun("These are my notes:");

        TextParagraph noteParagraph = notesText.AddParagraph();
        // Paragraph will be numbered.
        noteParagraph.Format.List.NumberType = ListNumberType.DecimalPeriod;
        // Move paragraph content a little bit from its number.
        noteParagraph.Format.IndentationSpecial = 
            Length.From(-0.64, LengthUnit.Centimeter);
        noteParagraph.AddRun("My first note");

        noteParagraph = notesText.AddParagraph();
        noteParagraph.Format.List.NumberType = ListNumberType.DecimalPeriod;
        noteParagraph.Format.IndentationSpecial = 
            Length.From(-0.64, LengthUnit.Centimeter);
        noteParagraph.AddRun("My second note");

        noteParagraph = notesText.AddParagraph();
        noteParagraph.Format.List.NumberType = ListNumberType.DecimalPeriod;
        noteParagraph.Format.IndentationSpecial = 
            Length.From(-0.64, LengthUnit.Centimeter);
        noteParagraph.AddRun("My third note");

        presentation.Save("Notes.pptx");
    }
}
Imports System.IO
Imports GemBox.Presentation
Imports GemBox.Presentation.Media

Module Samples

    Sub Main()

        ' If using Professional version, put your serial key below.
        ComponentInfo.SetLicense("FREE-LIMITED-KEY")

        Dim presentation As PresentationDocument = New PresentationDocument

        ' Add a blank slide to the presentation.
        Dim slide As Slide = presentation.Slides.AddNew(SlideLayoutType.Blank)

        ' Add a text box with some content to the slide.
        Dim text As TextBox = slide.Content.AddTextBox(3, 2, 22, 2, LengthUnit.Centimeter)
        text.AddParagraph().AddRun("This is my presentation with notes")

        ' Add notes to the slide.
        Dim notes As NotesSlide = slide.AddNotes()

        ' Using LINQ, find shape that contains notes text.
        Dim notesText As TextBox = notes.Content.Drawings.OfType(Of Shape)().
            Single(Function(sp) sp.Placeholder.PlaceholderType = PlaceholderType.Text).Text

        ' Start adding notes text and formatting.
        notesText.AddParagraph().AddRun("These are my notes:")

        Dim noteParagraph As TextParagraph = notesText.AddParagraph()
        ' Paragraph will be numbered.
        noteParagraph.Format.List.NumberType = ListNumberType.DecimalPeriod
        ' Move paragraph content a little bit from its number.
        noteParagraph.Format.IndentationSpecial =
            Length.From(-0.64, LengthUnit.Centimeter)
        noteParagraph.AddRun("My first note")

        noteParagraph = notesText.AddParagraph()
        noteParagraph.Format.List.NumberType = ListNumberType.DecimalPeriod
        noteParagraph.Format.IndentationSpecial =
            Length.From(-0.64, LengthUnit.Centimeter)
        noteParagraph.AddRun("My second note")

        noteParagraph = notesText.AddParagraph()
        noteParagraph.Format.List.NumberType = ListNumberType.DecimalPeriod
        noteParagraph.Format.IndentationSpecial =
            Length.From(-0.64, LengthUnit.Centimeter)
        noteParagraph.AddRun("My third note")

        presentation.Save("Notes.pptx")

    End Sub

End Module