在文本框中寻找每行不同的字体
Looking for different fonts per line in a textframe
我正在设计一个宏来验证 PowerPoint 演示文稿,检查幻灯片上的每个文本 box/shape,并输出字体类型、大小和颜色。我让它工作到它会吐出每个形状的字体大小,问题是当给定形状的每行有多个字体大小时。当前,如果例如第一行是 Arial 12,下一行是 Arial 14,则输出只是取第一行,并说有两行 Arial 12
Dim lFindColor As Long
Dim oSl As Slide
Dim oSh As Shape
Dim colorsUsed As String
Dim fontsUsed As String
Dim lRow As Long
Dim lCol As Long
Dim shpFont As String
Dim shpSize As String
Dim shpColour As String
Set oSl = ActiveWindow.View.Slide
Dim x As Integer
For Each oSh In oSl.Shapes
'----Shape Check----------------------------------------------------------
With oSh
If .HasTextFrame Then
If .TextFrame.HasText Then
For x = 1 To .TextFrame.TextRange.Runs.Count
shpFont = shpFont & .TextFrame.TextRange.Font.Name & ", "
shpSize = shpSize & .TextFrame.TextRange.Font.Size & ", "
shpColour = shpColour & .TextFrame.TextRange.Font.Color.RGB & ", "
Next
End If
End If
End With
Next
如何搜索每一行并为形状中的每一行提供字体 sizes/type?
您正在遍历 .Runs(如果完整的 TextRange 具有相同的方法和属性集,则它们是子集)但输出整个 TextRange 的样式属性。使用 .TextFrame.TextRange.Runs(x).Font.Name 等代替。
我正在设计一个宏来验证 PowerPoint 演示文稿,检查幻灯片上的每个文本 box/shape,并输出字体类型、大小和颜色。我让它工作到它会吐出每个形状的字体大小,问题是当给定形状的每行有多个字体大小时。当前,如果例如第一行是 Arial 12,下一行是 Arial 14,则输出只是取第一行,并说有两行 Arial 12
Dim lFindColor As Long
Dim oSl As Slide
Dim oSh As Shape
Dim colorsUsed As String
Dim fontsUsed As String
Dim lRow As Long
Dim lCol As Long
Dim shpFont As String
Dim shpSize As String
Dim shpColour As String
Set oSl = ActiveWindow.View.Slide
Dim x As Integer
For Each oSh In oSl.Shapes
'----Shape Check----------------------------------------------------------
With oSh
If .HasTextFrame Then
If .TextFrame.HasText Then
For x = 1 To .TextFrame.TextRange.Runs.Count
shpFont = shpFont & .TextFrame.TextRange.Font.Name & ", "
shpSize = shpSize & .TextFrame.TextRange.Font.Size & ", "
shpColour = shpColour & .TextFrame.TextRange.Font.Color.RGB & ", "
Next
End If
End If
End With
Next
如何搜索每一行并为形状中的每一行提供字体 sizes/type?
您正在遍历 .Runs(如果完整的 TextRange 具有相同的方法和属性集,则它们是子集)但输出整个 TextRange 的样式属性。使用 .TextFrame.TextRange.Runs(x).Font.Name 等代替。