我想阅读C#中PowerPoint幻灯片的注释。
关注Snippet对我有用。

slide.NotesPage.Shapes[2].TextFrame.TextRange.Text

但是,这不适用于某些演示文稿。
然后,它将引发“超出范围”异常。

索引2的含义是什么?还有其他选择吗?

最佳答案

您不能假定注释文本占位符将位于任何特定的索引,甚至不能具有特定的名称。这是VBA中的一个简单函数,该函数返回幻灯片的注释文本占位符:

Function NotesTextPlaceholder(oSl As Slide) As Shape

Dim osh As Shape

For Each osh In oSl.NotesPage.Shapes

    If osh.Type = msoPlaceholder Then
        If osh.PlaceholderFormat.Type = ppPlaceholderBody Then
            ' we found it
            Set NotesTextPlaceholder = osh
            Exit Function
        End If
    End If

Next

结束功能

关于c# - C#中的PowerPoint注释,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/6252927/

10-10 10:23