跳到主要内容

GetContent

返回当前单元格的内容。

语法

expression.GetContent();

expression - 表示 ApiTableCell 类的变量。

参数

此方法没有任何参数。

返回值

ApiDocumentContent

示例

此示例展示如何获取当前单元格的内容。

// How to get the value from the cell.

// Retrieve the content of the table cell.

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);
let cell = table.GetRow(0).GetCell(0);
cell.GetContent().GetElement(0).AddText("Cell #1");
table.SetStyle(tableStyle);
doc.Push(table);