InsertInContentControl
Wraps the current table object with a content control.
Syntax
expression.InsertInContentControl(nType);
expression
- A variable that represents a ApiTable class.
Parameters
Name | Required/Optional | Data type | Default | Description |
---|---|---|---|---|
nType | Required | number | Defines if this method returns the ApiBlockLvlSdt (nType === 1) or ApiTable (any value except 1) object. |
Returns
Example
This example wraps the current table object with a content control.
let doc = Api.GetDocument();
let tableStyle = doc.CreateStyle("CustomTableStyle", "table");
tableStyle.SetBasedOn(doc.GetStyle("Bordered"));
let table = Api.CreateTable(3, 3);
table.SetWidth("percent", 100);
table.SetStyle(tableStyle);
let blockLvlSdt = table.InsertInContentControl(1);
doc.AddElement(0, blockLvlSdt);