Get Started
Usage API
More information

MergeCells

MergeCells(aCells) → { ApiTableCell }

Merge array of cells. If merge was done successfully, it will return merged cell, otherwise "null". Warning: The number of cells in any row and the number of rows in the current table may be changed.

Parameters:

Name Type Description
aCells Array.<ApiTableCell>

The array of cells.

Returns:

Type
ApiTableCell

Example

Copy code
builder.CreateFile("pptx");
oPresentation = Api.GetPresentation();
oTable = Api.CreateTable(2, 4);
oRow = oTable.GetRow(0);
oCell1 = oRow.GetCell(0);
oCell2 = oRow.GetCell(1);
oTable.MergeCells([oCell1, oCell2]);
oCell = oRow.GetCell(0);
oContent = oCell.GetContent();
oParagraph = Api.CreateParagraph();
oParagraph.AddText("This cell was formed by merging two cells.");
oContent.Push(oParagraph);
oSlide = oPresentation.GetSlideByIndex(0);
oSlide.RemoveAllObjects();
oSlide.AddObject(oTable);
builder.SaveFile("pptx", "MergeCells.pptx");
builder.CloseFile();

Resulting document