GetIndex
返回当前单元格的索引。
语法
expression.GetIndex();
expression - 表示 ApiTableCell 类的变量。
参数
此方法没有任何参数。
返回值
Number
示例
此示例展示如何获取单元格索引。
// How to get position index of the cell.
// Retrieve the index of the table cell and display it in the 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("Cell index: " + table.GetCell(0, 0).GetIndex());