TabStop 对象(Word)TabStop object (Word)

代表单个制表位。Represents a single tab stop. TabStop 对象是 TabStops 集合的一个成员。The TabStop object is a member of the TabStops collection. TabStops 集合代表所有自定义和一个段落或一组段落中的默认制表位。The TabStops collection represents all the custom and default tab stops in a paragraph or group of paragraphs.

备注Remarks

使用TabStops (索引),其中索引是制表位的位置(以磅为单位)或索引号,返回一个TabStop对象。Use TabStops (Index), where Index is the location of the tab stop (in points) or the index number, to return a single TabStop object. 制表位按数字进行索引从左到右沿标尺。Tab stops are indexed numerically from left to right along the ruler. 下面的示例删除所选段落的第一个自定义制表位。The following example removes the first custom tab stop from the selected paragraphs.

Selection.Paragraphs.TabStops(1).Clear

以下示例在所选段落的 2 英寸处添加一个右对齐制表位。The following example adds a right-aligned tab stop positioned at 2 inches to the selected paragraphs.

Selection.Paragraphs.TabStops(InchesToPoints(2)) _ 
 .Alignment = wdAlignTabRight

使用 Add 方法添加一个制表位。Use the Add method to add a tab stop. 下面的示例将所选段落添加两个制表位。The following example adds two tab stops to the selected paragraphs. 第一个制表位为左对齐,使用点式的制表符前导符位于 1 英寸 (72 磅)。The first tab stop is a left-aligned tab with a dotted tab leader positioned at 1 inch (72 points). 第二个制表位是位居中,位于 2 英寸处。The second tab stop is centered and is positioned at 2 inches.

With Selection.Paragraphs.TabStops 
 .Add Position:=InchesToPoints(1), _ 
 Leader:=wdTabLeaderDots, Alignment:=wdAlignTabLeft 
 .Add Position:=InchesToPoints(2), Alignment:=wdAlignTabCenter 
End With

您还可以添加制表位 TabStops 属性指定一个位置。You can also add a tab stop by specifying a location with the TabStops property. 下面的示例将添加位于 2 英寸到所选段落右对齐制表位。The following example adds a right-aligned tab stop positioned at 2 inches to the selected paragraphs.

Selection.Paragraphs.TabStops(InchesToPoints(2)) _ 
 .Alignment = wdAlignTabRight

备注

[!注释] 设置 DefaultTabStop 属性来调整默认制表位的间距。Set the DefaultTabStop property to adjust the spacing of default tab stops.

另请参阅See also

Word 对象模型参考Word Object Model Reference

支持和反馈Support and feedback

有关于 Office VBA 或本文档的疑问或反馈?Have questions or feedback about Office VBA or this documentation? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.