AddColumn
function AddColumn(oCell: ApiTableCell = null, isBefore: boolean = false): void
Description
Adds a new column to the current table.
Parameters
The cell after which a new column will be added. If not specified, a new column will be added at the end of the table.
- isBefore
boolean
false Adds a new column 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 oParagraph = oDocument.GetElement(0);
oParagraph.AddText("We create a 2x2 table and add a new column, so that it becomes 3x2:");
var oTableStyle = oDocument.CreateStyle("CustomTableStyle", "table");
oTableStyle.SetBasedOn(oDocument.GetStyle("Bordered"));
var oTable = Api.CreateTable(2, 2);
oTable.SetWidth("percent", 100);
oTable.SetStyle(oTableStyle);
oTable.AddColumn(oTable.GetRow(0).GetCell(1), true);
oDocument.Push(oTable);