Get Started
Usage API
More information

AddColumns

AddColumns(nCount, [isBefore]) → { ApiTable | null }

Add the new columns to the current table.

Parameters:

Name Type Default Description
nCount Number

Count of columns to be added.

isBefore boolean false

Specifies if the new columns will be added before or after the cell.

Returns:

Type
ApiTable | null

Example

Copy code
builder.CreateFile("docx");
oDocument = Api.GetDocument();
oTableStyle = oDocument.CreateStyle("CustomTableStyle", "table");
oTableStyle.SetBasedOn(oDocument.GetStyle("Bordered - Accent 5"));
oTable = Api.CreateTable(3, 3);
oTable.SetWidth("percent", 100);
oTable.SetStyle(oTableStyle);
oDocument.Push(oTable);
oTable.GetCell(0, 0).GetContent().GetElement(0).AddText("Two new columns were added after this cell.");
oTable.GetCell(0, 0).AddColumns(2, false);
builder.SaveFile("docx", "AddColumns.docx");
builder.CloseFile();

Resulting document