跳到主要内容

GetInternalId

返回当前表格单元格的内部 ID。

语法

expression.GetInternalId();

expression - 表示 ApiTableCell 类的变量。

参数

此方法没有任何参数。

返回值

string

示例

此示例展示如何获取表格单元格的内部 ID。

const doc = Api.GetDocument();
const table = Api.CreateTable(3, 3);
table.SetWidth('percent', 100);
doc.Push(table);

for (let rowIndex = 0; rowIndex < 3; rowIndex++) {
for (let colIndex = 0; colIndex < 3; colIndex++) {
const cell = table.GetCell(rowIndex, colIndex);
const cellParagraph = cell.GetContent().GetElement(0);
cellParagraph.AddText('This cell ID: ' + cell.GetInternalId());
}
}