跳到主要内容

GetRowIndex

返回父行的索引。

语法

expression.GetRowIndex();

expression - 表示 ApiTableCell 类的变量。

参数

此方法没有任何参数。

返回值

number

示例

查找文档中表格单元格的行位置。

// How do I determine which row a table cell is located in in a document?

// Look up the row number that a table cell occupies in a document.

let doc = Api.GetDocument();
let tableStyle = doc.CreateStyle("CustomTableStyle", "table");
tableStyle.SetBasedOn(doc.GetStyle("Bordered"));
let table = Api.CreateTable(3, 3);
table.SetWidth("percent", 100);
table.SetStyle(tableStyle);
doc.Push(table);
table.GetCell(0, 0).GetContent().GetElement(0).AddText("Row index: " + table.GetCell(0, 0).GetRowIndex());