Get Started
Documentation

RemoveColumn

RemoveColumn(oCell) → {boolean}

Remove the table column with a specified cell.

Parameters:

Name Type Description
oCell ApiTableCell The cell which is present in the column that will be removed.

Returns:

Whether the table is empty after the column removal or there are any columns left.

Type
boolean

Example

Copy code
builder.CreateFile("docx");
var oDocument = Api.GetDocument();
var oParagraph, oTable, oTableStyle, oCell;
oParagraph = oDocument.GetElement(0);
oParagraph.AddText("We create a 3x3 table and remove one column (the second one), so that it becomes 2x3:");
oTableStyle = oDocument.CreateStyle("CustomTableStyle", "table");
oTableStyle.SetBasedOn(oDocument.GetStyle("Bordered - Accent 5"));
oTable = Api.CreateTable(3, 3);
oTable.SetWidth("percent", 100);
oTable.SetStyle(oTableStyle);
oCell = oTable.GetRow(2).GetCell(1);
oTable.RemoveColumn(oCell);
oDocument.Push(oTable);
builder.SaveFile("docx", "RemoveColumn.docx");
builder.CloseFile();

Resulting document