Get Started
Documentation

SetStyle

SetStyle(oStyle)

Set the style for the current table.

Parameters:

Name Type Description
oStyle ApiStyle The style which will be applied to the current table.

Example

Copy code
builder.CreateFile("docx");
var oDocument = Api.GetDocument();
var oParagraph, oTable, oTableStyle;
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