I want to read the notes of a PowerPoint Slide in C#. Following Snippet works for me.
slide.NotesPage.Shapes[2].TextFrame.TextRange.Text
However, this doesn't work for some presentations. Then it throws an "Out of range" exception.
What ist the meaning of index 2? Are there any alternative to do this?
Taking Notes on PowerPoint Slides This can be done electronically by using the “Click to add notes” feature on each slide, or by printing the PowerPoint presentation as “Handouts” with lines next to each slide for your own written comments.
What are speaker notes in PowerPoint? Speaker notes in PowerPoint help presenters recall important points, such as key messages or stats, as they give a presentation. The speaker note panel lives at the bottom of your screen in Normal view, although some users may have this section hidden.
Importing PowerPoint presentations from within GoodNotesTap the New… icon (large plus icon) in the Documents tab and choose Import, then tap a file to start the import!
You can't assume that the notes text placeholder will be at any specific index or even that it'll have a specific name. Here's a simple function in VBA that returns the notes text placeholder for a slide:
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
End Function
It means that you are trying to access the third element of the slide.NotesPage.Shapes
collection. If the collection has 2 elements or less, the exception is thrown because the element at the specified index 2 could not be accessed since it doesn't exist — you simply cannot retrieve a collection's third element if it doesn't have one.
(The index is zero-based, meaning that the first element is given the index 0, the second one is given the index 1 and so on. Thus, the greatest possible index of a collection with N elements is N-1.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With