如果您不必這樣做,那麼就不需要去OpenXML--這可以通過對象模型完成。這是如何在VBA中完成的,它可以輕鬆移植到C#或VB.NET。
Sub PrintInteralLinks()
Dim ap As Presentation
Set ap = ActivePresentation
Dim hs As Hyperlinks
Dim h As Hyperlink
Dim sl As Slide
Dim linkedToSlide As String
Dim slideTitle As Integer
For Each sl In ap.Slides
Set hs = sl.Hyperlinks
For Each h In hs
slideTitle = InStrRev(h.SubAddress, ",")
If slideTitle > 0 Then
linkedToSlide = Mid(h.SubAddress, slideTitle + 1)
Debug.Print sl.Name & " links to " & linkedToSlide
End If
Next
Next
End Sub
slideTitle = InStrRev(h.SubAddress, ",")
雖然不是萬無一失的。內部鏈接的模式爲#,#,Slide Title
,因此您可能需要像使用某些RegEx一樣使其更好。