AddColumns
function AddColumns(oCell: ApiTableCell = null, nCount: Number = null, isBefore: boolean = false): void
Description
Adds the new columns to the current table.
Parameters
The cell after which the new columns will be added. If not specified, the new columns will be added at the end of the table.
- nCount
Number
null Count of columns to be added.
- isBefore
boolean
false Adds the new columns before (false) or after (true) the specified cell. If no cell is specified, then this parameter will be ignored.
Returns
void
Try It
var oDocument = Api.GetDocument();
var oTableStyle = oDocument.CreateStyle("CustomTableStyle", "table");
oTableStyle.SetBasedOn(oDocument.GetStyle("Bordered"));
var oTable = Api.CreateTable(3, 3);
oTable.SetWidth("percent", 100);
oTable.SetStyle(oTableStyle);
oDocument.Push(oTable);
var oCell = oTable.GetCell(0, 0).GetContent().GetElement(0).AddText("Two new columns were added after this cell.");
oTable.AddColumns(oCell, 2, false);