跳到主要内容

GetContent

返回当前单元格的内容。

语法

expression.GetContent();

expression - 表示 ApiTableCell 类的变量。

参数

此方法没有任何参数。

返回值

ApiDocumentContent

示例

如何获取 ApiTableCell 对象的内容。

// Return the ApiDocumentContent object from the table cell.

const doc = Api.GetDocument();
const page = doc.GetPage(0);

const table = Api.CreateTable(2, 4);
const row = table.GetRow(0);
const cell = row.GetCell(0);
const content = cell.GetContent();
const paragraph = Api.CreateParagraph();
paragraph.AddText("This is a sample text in the cell.");
content.Push(paragraph);

page.AddObject(table);