Search code examples
c#powerpoint

How to read and store speaker notes from PowerPoint presentation file


How to read and store speaker notes from PowerPoint presentation file that is stored in my hard drive location?

using Microsoft.Office.Interop.PowerPoint;

Application PowerPoint_App = new Application();
Presentations multi_presentations = PowerPoint_App.Presentations;
Presentation presentation = multi_presentations.Open(@"D:\Peak Sourcing\Work\ppt_test\presenting.ppt");

Solution

  • Each slide in the presentation's Slides collection has a NotePage member. The NotesPage is basically a separate slide with all the same collections and methods. Here's a VBA function that will return the notes text from a slide:

    Function NotesText(oSl As Slide) As String
    
        Dim oSh As Shape
        
        For Each oSh In oSl.NotesPage.Shapes
            If oSh.Type = msoPlaceholder Then
                If oSh.PlaceholderFormat.Type = ppPlaceholderBody Then
                    If oSh.TextFrame.HasText Then
                        NotesText = oSh.TextFrame.TextRange.Text
                    End If
                End If
            End If
        Next
    
    End Function