跳到主要内容

AddRow

Adds a new row to the current table.

Syntax

expression.AddRow(oCell, isBefore);

expression - A variable that represents a ApiTable class.

Parameters

NameRequired/OptionalData typeDefaultDescription
oCellOptionalApiTableCellIf not specified, a new row will be added to the end of the table.
isBeforeOptionalbooleanfalseAdds a new row before or after the specified cell. If no cell is specified, then this parameter will be ignored.

Returns

ApiTableRow

Example

This example adds a new row to the table.

var oPresentation = Api.GetPresentation();
var oTable = Api.CreateTable(2, 4);
oTable.AddRow(1, true);
var oRow = oTable.GetRow(1);
var oCell = oRow.GetCell(0);
var oContent = oCell.GetContent();
var oParagraph = Api.CreateParagraph();
oParagraph.AddText("New row was added here.");
oContent.Push(oParagraph);
var oSlide = oPresentation.GetSlideByIndex(0);
oSlide.RemoveAllObjects();
oSlide.AddObject(oTable);