我只想从标题形状中获取字体大小,但我的代码会检查所有形状的RunProperties:
Public Function GetSlideTitle(ByVal slidePart As SlidePart) As String()
If (Not (slidePart.Slide) Is Nothing) Then
' Find all the title shapes.
Dim shapes = From shape In slidePart.Slide.Descendants(Of Shape)() _
Where (IsTitleShape(shape)) _
Select shape
Dim paragraphText As StringBuilder = New StringBuilder
Dim minFont As Double = 200000
Dim maxfont As Double = 0
''''getting the text from the title shapes - this works fine
For Each shape As Object In shapes
For Each paragraph As Drawing.Paragraph In shape.TextBody.Descendants(Of D.Paragraph)()
For Each text As Object In paragraph.Descendants(Of D.Text)()
paragraphText.Append(text.Text)
Next
Next
Next
'''' This is the part in question:
Dim runProList As Drawing.RunProperties() = slidePart.Slide.Descendants(Of Drawing.RunProperties)().ToArray()
For Each r As Drawing.RunProperties In runProList
If Not IsNothing(r) AndAlso Not IsNothing(r.FontSize) Then
If r.FontSize.Value > 0 AndAlso minFont > r.FontSize.Value Then minFont = r.FontSize.Value
If maxfont < r.FontSize.Value Then maxfont = r.FontSize.Value
End If
Next
Return New String() {paragraphText.ToString, minFont.ToString, maxfont.ToString}
End If
Return New String() {String.Empty}
End Function
我如何知道哪个RunProperty属于给定的形状?