word range html,Range.HTMLDivisions property (Word)

这段代码示例展示了如何使用Word VBA格式化HTML文档内的分区。它首先选取活动文档的第一个HTML分区,并设置其边框颜色和样式,然后调整左右缩进,接着对内部的分区应用不同的边框样式。这适用于处理含有多个HTML分区的Word文档。
摘要由CSDN通过智能技术生成

Range.HTMLDivisions property (Word)

06/08/2017

2 minutes to read

In this article

Returns an HTMLDivisions object that represents an HTML division in a web document.

Syntax

expression. HTMLDivisions

expression Required. A variable that represents a

Example

This example formats three nested divisions in the active document. This example assumes that the active document is an HTML document with at least three divisions.

Sub FormatHTMLDivisions()

With ActiveDocument.Range.HTMLDivisions(1)

With .Borders(wdBorderLeft)

.Color = wdColorRed

.LineStyle = wdLineStyleSingle

End With

With .Borders(wdBorderRight)

.Color = wdColorRed

.LineStyle = wdLineStyleSingle

End With

With .HTMLDivisions(1)

.LeftIndent = InchesToPoints(1)

.RightIndent = InchesToPoints(1)

With .Borders(wdBorderTop)

.Color = wdColorBlue

.LineStyle = wdLineStyleDouble

End With

With .Borders(wdBorderBottom)

.Color = wdColorBlue

.LineStyle = wdLineStyleDouble

End With

With .HTMLDivisions(1)

.LeftIndent = InchesToPoints(1)

.RightIndent = InchesToPoints(1)

With .Borders(wdBorderLeft)

.LineStyle = wdLineStyleDot

End With

With .Borders(wdBorderRight)

.LineStyle = wdLineStyleDot

End With

With .Borders(wdBorderTop)

.LineStyle = wdLineStyleDot

End With

With .Borders(wdBorderBottom)

.LineStyle = wdLineStyleDot

End With

End With

End With

End With

End Sub

See also

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值