跳到主要内容

RemoveRow

删除包含指定单元格的表格行。

语法

expression.RemoveRow(oCell);

expression - 表示 ApiTable 类的变量。

参数

名称必需/可选数据类型默认值描述
oCell必需ApiTableCell将被删除的行中的表格单元格。

返回值

boolean

示例

此示例删除包含指定单元格的表格行。

// How to delete a row from the table.

// Create a table, create cells and remove the whole row by its cell.

const presentation = Api.GetPresentation();
const slide = presentation.GetSlideByIndex(0);

const table = Api.CreateTable(2, 4);
let row = table.GetRow(0);
let cell = row.GetCell(0);
table.RemoveRow(cell);
row = table.GetRow(0);
cell = row.GetCell(0);
const content = cell.GetContent();
const paragraph = Api.CreateParagraph();
paragraph.AddText("The first row was removed.");
content.Push(paragraph);

slide.RemoveAllObjects();
slide.AddObject(table);