Get Started
Documentation

AddColumn

AddColumn(oCellopt, isBeforeopt)

Add a new column to the current table.

Parameters:

Name Type Attributes Default Description
oCell ApiTableCell <optional>
The cell after which the new column will be added. If not specified the new column will be added at the end of the table.
isBefore boolean <optional>
false Add a new column before or after the specified cell. If no cell is specified then this parameter will be ignored.

Example

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

Resulting document