我们在排版ppt时有时会碰到ppt内每张幻灯片上的文字的字体不统一现象,尤其是排版菜鸟的ppt作品时或者在排版多人合作的ppt时经常会出现这种情况。
ppt不像word,word可以提供【样式】功能或者强大的【查找和替换功】能进行批量的修改。
不过ppt内可以通过vba代码快速实现你的要求:
--------------------------------------------------------------------------------
sub 快速将当前演示文稿内的字体统一格式化为微软雅黑()
Dim oSl As Slide
Dim oSh As Shape
Dim sFontName As String
Dim Ctr As Integer
Dim Cl As Cell
sFontName = "微软雅黑"
With ActivePresentation
For Each oSl In .Slides
For Each oSh In oSl.Shapes
With oSh
Select Case .Type
Case msoGroup
For Ctr = 1 To .GroupItems.Count
If .GroupItems(Ctr).HasTextFrame Then
.GroupItems(Ctr).TextFrame.TextRange.Font.Name = sFontName
.GroupItems(Ctr).TextFrame.TextRange.Font.NameFarEast = sFontName
.GroupItems(Ctr).TextFrame.TextRange.Font.NameOther = sFontName
End If
Next Ctr
Case msoTable
For Ctr = 1 To .Table.Rows.Count
For Each Cl In .Table.Rows(Ctr).Cells
Cl.Shape.TextFrame.TextRange.Font.Name = sFontName
Cl.Shape.TextFrame.TextRange.Font.NameFarEast = sFontName
Cl.Shape.TextFrame.TextRange.Font.NameOther = sFontName
Next Cl
Next Ctr
Case Else
If .HasTextFrame Then
If .TextFrame.HasText Then
.TextFrame.TextRange.Font.Name = sFontName
.TextFrame.TextRange.Font.NameFarEast = sFontName
.TextFrame.TextRange.Font.NameOther = sFontName
End If
End If
End Select
End With
Next
Next
End With
End Sub