MergeCells
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 numbers of rows in the current table may be changed.
Parameters:
Name |
Type |
Description |
aCells |
Array.<ApiTableCell>
|
|
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