HTMLDivisionParent 方法

       

返回一个 HTMLDivision 对象,该对象代表当前 HTML 区域中的父区域。

expression.HTMLDivisionParent(LevelsUp)

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

LevelsUp  Long 类型,可选。计数父区域的数目,以返回所需的区域。如果省略 LevelsUp 参数,则返回的 HTML 区域是当前 HTML 区域的上一级。

示例

本示例设置活动文档中的两个 HTML 区域的边框格式。本示例假定活动文档是至少包含两个区域的 HTML 文档。

Sub FormatHTMLDivisions()
    With ActiveDocument.HTMLDivisions(1)
        With .HTMLDivisions(1)
            .LeftIndent = InchesToPoints(1)
            .RightIndent = InchesToPoints(1)
            With .Borders(wdBorderLeft)
                .Color = wdColorBlue
                .LineStyle = wdLineStyleDouble
            End With
            With .Borders(wdBorderRight)
                .Color = wdColorBlue
                .LineStyle = wdLineStyleDouble
            End With
            With .HTMLDivisionParent
                .LeftIndent = InchesToPoints(1)
                .RightIndent = InchesToPoints(1)
                With .Borders(wdBorderTop)
                    .Color = wdColorBlack
                    .LineStyle = wdLineStyleDot
                End With
                With .Borders(wdBorderBottom)
                    .Color = wdColorBlack
                    .LineStyle = wdLineStyleDot
                End With
            End With
        End With
    End With
End Sub