Skip to main content

SetStyle

Sets a style to the current table.

Syntax

expression.SetStyle(oStyle);

expression - A variable that represents a ApiTable class.

Parameters

NameRequired/OptionalData typeDefaultDescription
oStyleRequiredApiStyleThe style which will be applied to the current table.

Returns

boolean

Example

This example sets a style to the table.

let doc = Api.GetDocument();
let paragraph = doc.GetElement(0);
paragraph.AddText("We create a table and apply one of the existing styles to it:");
let tableStyle = doc.GetStyle("Bordered");
let table = Api.CreateTable(2, 2);
table.SetWidth("percent", 100);
table.SetStyle(tableStyle);
doc.Push(table);