WPS 加载项开发 > 文字 API 参考 > Range > 属性 > Range.HTMLDivisions 属性
返回一个 HTMLDivisions 对象,该对象代表 Web 文档中的 HTML 划分。

语法

表达式.HTMLDivisions

表达式   必选。一个代表 Range 对象的变量。

示例

以下示例设置活动文档中三个嵌套划分的格式。本示例假定该活动文档为具有至少三个划分的 HTML 文档。

示例代码
function FormatHTMLDivisions() {
    let htmlDiv1 = ActiveDocument.Range().HTMLDivisions.Item(1)
    htmlDiv1.Borders.Item(wdBorderLeft).Color = wdColorRed
    htmlDiv1.Borders.Item(wdBorderLeft).LineStyle = wdLineStyleSingle
    htmlDiv1.Borders.Item(wdBorderRight).Color = wdColorRed
    htmlDiv1.Borders.Item(wdBorderRight).LineStyle = wdLineStyleSingle
    
    let htmlDiv2 = htmlDiv1.HTMLDivisions.Item(1)
    htmlDiv2.LeftIndent = InchesToPoints.Item(1)
    htmlDiv2.RightIndent = InchesToPoints.Item(1)
    htmlDiv2.Borders.Item(wdBorderTop).Color = wdColorBlue
    htmlDiv2.Borders.Item(wdBorderTop).LineStyle = wdLineStyleDouble
    htmlDiv2.Borders.Item(wdBorderBottom).Color = wdColorBlue
    htmlDiv2.Borders.Item(wdBorderBottom).LineStyle = wdLineStyleDouble
        
    let htmlDiv3 = htmlDiv2.HTMLDivisions.Item(1)
    htmlDiv3.LeftIndent = InchesToPoints(1)
    htmlDiv3.RightIndent = InchesToPoints(1)
    htmlDiv3.Borders.Item(wdBorderLeft).LineStyle = wdLineStyleDot
    htmlDiv3.Borders.Item(wdBorderRight).LineStyle = wdLineStyleDot
    htmlDiv3.Borders.Item(wdBorderTop).LineStyle = wdLineStyleDot
    htmlDiv3.Borders.Item(wdBorderBottom).LineStyle = wdLineStyleDot
}


请参阅