Finding PowerPoint slide number & slide title in VSTO
I am writing a small plugin on ASP.NET C# VSTO and 开发者_JS百科I want to be able to capture slide number and title of the slides when a slideshow is happening.
Can someone share sample code to capture title of the slide and slide number?
PowerPoint.SlideShowWindow.Presentation.SlideShowWindow.View.CurrentShowPosition
Presentation pres = Globals.ThisAddIn.Application.ActivePresentation;
foreach (Slide s in pres.Slides)
{
MessageBox.Show(s.SlideIndex);
}
The Slide title I don't know, yet
Capture event SlideShowNextSlide
and from the Wn
variable, get the slide's index/title. Here's a VBA example:
Private Sub app_SlideShowNextSlide(ByVal Wn As SlideShowWindow)
Dim s As Slide
s = Wn.View.Slide
Dim slideTitle As String
If s.Layout <> ppLayoutBlank Then
If s.Shapes.HasTitle Then
slideTitle = s.Shapes.Title
Else
slideTitle = "(nothing)"
End If
End If
Dim sIndex As Integer
sIndex = s.SlideIndex
End Sub
精彩评论