Row 对象(Word)Row object (Word)

表示表中的行。Represents a row in a table. 对象所在 集合。The Row object is a member of the Rows collection. Rows 集合包含指定的所选内容、 范围或表格中所有行。The Rows collection includes all the rows in the specified selection, range, or table.


使用(索引),其中索引是索引号,返回单个Row对象。Use Rows (Index), where Index is the index number, to return a single Row object. 索引号代表选定内容、 范围或表格中的行位置。The index number represents the position of the row in the selection, range, or table. 下面的示例删除活动文档中第一个表格的第一行。The following example deletes the first row in the first table in the active document.


使用 添加 将行添加到表的方法。Use the Add method to add a row to a table. 下面的示例在所选内容中插入的第一行之前的行。The following example inserts a row before the first row in the selection.

If Selection.Information(wdWithInTable) = True Then 
 Selection.Rows.Add BeforeRow:=Selection.Rows(1) 
End If

使用 单元格 的属性来修改对象中的 的各单元格。Use the Cells property to modify the individual cells in a Row object. 下面的示例对所选内容中添加一个表,并在表格第二行中的每个单元格插入数字。The following example adds a table to the selection and then inserts numbers into each cell in the second row of the table.

Selection.Collapse Direction:=wdCollapseEnd 
If Selection.Information(wdWithInTable) = False Then 
 Set myTable = _ 
 ActiveDocument.Tables.Add(Range:=Selection.Range, _ 
 NumRows:=3, NumColumns:=5) 
 For Each aCell In myTable.Rows(2).Cells 
 i = i + 1 
 aCell.Range.Text = i 
 Next aCell 
End If

另请参阅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.