跳到主要内容

GetRow

按索引返回行。

语法

expression.GetRow(rowIndex);

expression - 表示 ApiTable 类的变量。

参数

名称必需/可选数据类型默认值描述
rowIndex必需number表格中从零开始的行索引。

返回值

ApiTableRow

示例

从 PDF 中的表格访问特定行。

// How do I select a table row by its position in a PDF?

// Extract the row you need from a table in a PDF.

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

const table = Api.CreateTable(2, 4);
table.AddRow(1, true);
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 first row.");
content.Push(paragraph);

page.AddObject(table);