Get Started
Documentation

SetStyle

SetStyle(oStyle) → { bool }

Set the style for the current table.

Parameters:

Name Type Description
oStyle ApiStyle

The style which will be applied to the current table.

Returns:

Type
bool

Example

Copy code
builder.CreateFile("docx");
oDocument = Api.GetDocument();
oParagraph = oDocument.GetElement(0);
oParagraph.AddText("We create a table and apply one of the existing styles to it:");
oTableStyle = oDocument.GetStyle("Bordered - Accent 5");
oTable = Api.CreateTable(2, 2);
oTable.SetWidth("percent", 100);
oTable.SetStyle(oTableStyle);
oDocument.Push(oTable);
builder.SaveFile("docx", "SetStyle.docx");
builder.CloseFile();

Resulting document