跳到主要内容

GetPrevious

返回上一行(如果存在)。

语法

expression.GetPrevious();

expression - 表示 ApiTableRow 类的变量。

参数

此方法没有任何参数。

返回值

ApiTableRow | null

示例

此示例展示如何获取上一行。

// Get the previous row from the current row.

// Display the second and the first row.

let doc = Api.GetDocument();
let tableStyle = doc.CreateStyle("CustomTableStyle", "table");
tableStyle.SetBasedOn(doc.GetStyle("Bordered"));
let table = Api.CreateTable(3, 3);
table.SetStyle(tableStyle);
let row = table.GetRow(1);
row.GetCell(1).GetContent().GetElement(0).AddText("Second row");
row.GetPrevious().GetCell(1).GetContent().GetElement(0).AddText("First row");
doc.Push(table);