如何从 PowerPoint 演示文稿文件中读取和存储演讲者备注

How to read and store speaker notes from PowerPoint presentation file

如何从存储在我的硬盘驱动器位置的 PowerPoint 演示文稿文件中读取和存储演讲者备注?

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

演示文稿的幻灯片集合中的每张幻灯片都有一个 NotePage 成员。 NotesPage 基本上是一个单独的幻灯片,具有所有相同的集合和方法。这是一个 VBA 函数,它将 return 幻灯片中的注释文本:

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