跳到主要内容

GetPrevious

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

语法​

expression.GetPrevious();

expression - 表示 ApiTableRow 类的变量。

参数​

此方法没有任何参数。

返回值​

ApiTableRow | null

示例​

在演示文稿中获取上一行。

// Useful for getting the previous row from a table row.

// Display text in the second and first rows using GetPrevious.

const presentation = Api.GetPresentation();
const slide = presentation.GetSlideByIndex(0);
const table = Api.CreateTable(2, 3);
const secondRow = table.GetRow(1);
const para = Api.CreateParagraph();
para.AddText("First row");
const para2 = Api.CreateParagraph();
para2.AddText("Second row");
secondRow.GetCell(0).GetContent().Push(para2);
secondRow.GetPrevious().GetCell(0).GetContent().Push(para);
slide.RemoveAllObjects();
slide.AddObject(table);