SetTableTitle
Sets the table title (caption).
Syntax
expression.SetTableTitle(sTitle);
expression
- A variable that represents a ApiTablePr class.
Parameters
Name | Required/Optional | Data type | Default | Description |
---|---|---|---|---|
sTitle | Required | string | The table title to be set. |
Returns
boolean
Example
This example sets the table title.
let doc = Api.GetDocument();
let tableStyle = doc.CreateStyle("CustomTableStyle", "table");
tableStyle.SetBasedOn(doc.GetStyle("Bordered"));
let tablePr = tableStyle.GetTablePr();
let table = Api.CreateTable(3, 3);
table.SetWidth("percent", 100);
tablePr.SetTableTitle("Table 1");
table.SetStyle(tableStyle);
let paragraph = doc.GetElement(0);
paragraph.AddText("Table title: " + tablePr.GetTableTitle());
doc.Push(table);