DistanceFrom 属性

       

此属性返回或设置数值,该值指明指定的页面边框是从页面边框还是从环绕的文本开始度量。WdBorderDistanceFrom,可读写。

expression.DistanceFrom

expression   必需。该表达式返回“应用于”列表中的一个对象。

示例

本示例为活动文档中第一节的每个页面添加单线型边框,然后设置每个边框到页面边缘的距离。

Dim borderLoop As Border

With ActiveDocument.Sections(1)
    For Each borderLoop In .Borders
        borderLoop.LineStyle = wdLineStyleSingle
        borderLoop.LineWidth = wdLineWidth050pt
    Next borderLoop
    With .Borders
        .DistanceFrom = wdBorderDistanceFromPageEdge
        .DistanceFromTop = 20
        .DistanceFromLeft = 22
        .DistanceFromBottom = 20
        .DistanceFromRight = 22
    End With
End With

本示例为所选内容的第一节的每个页面添加边框,然后将文本与页面边框的距离设置为 6 磅。

Dim borderLoop As Border

With Selection.Sections(1)
    For Each borderLoop In .Borders
        borderLoop.ArtStyle = wdArtSeattle
        borderLoop.ArtWidth = 22
    Next borderLoop
    With .Borders
        .DistanceFrom = wdBorderDistanceFromText
        .DistanceFromTop = 6
        .DistanceFromLeft = 6
        .DistanceFromBottom = 6
        .DistanceFromRight = 6
    End With
End With