文本格式:设置底纹

使用Range对象的Shading属性返回一个Shading对象,设置该对象的属性,可以给文本添加底纹。

下面给定义的字符序列添加阴影和倒影,并添加10%灰度底纹。使用Shading对象的Texture属性设置底纹纹理类型。

code.vba
Sub Test()
  Dim doc As Document
  Set doc = Documents.Open("D:\test2.docx")
  Dim rng As Range
  Set rng = doc.Range(Start:=26, End:=34)
  rng.Font.Size = 40
  rng.Font.Bold = True
  rng.Font.TextColor.RGB = 255

  rng.Font.TextShadow.Visible = True
  rng.Font.Reflection.Type = msoReflectionType2

  rng.Shading.Texture = wdTextureDiagonalCross
End Sub

设置效果如图3-17所示。

Document Image

图3-17 给文本添加底纹