Get Started
Documentation

ApiStyle

new ApiStyle()

Class representing a style.

Methods

Name Description
GetClassType

Get the type of this class.

GetConditionalTableStyle

Get a set of formatting properties which will be conditionally applied to the parts of a table that match the requirement specified in the sType parameter.

GetName

Get the name of the current style.

GetParaPr

Get the paragraph properties of the current style.

GetTableCellPr

Get the table cell properties for the current style.

GetTablePr

Get the table properties of the current style.

GetTableRowPr

Get the table row properties of the current style.

GetTextPr

Get the text properties of the current style.

GetType

Get the type of the current style.

SetBasedOn

Specify the reference to the parent style which this style inherits from in the style hierarchy.

SetName

Set the name of the current style.

Example

Copy code
builder.CreateFile("docx");
var oDocument = Api.GetDocument();
var oTable, oTableStyle;
oTableStyle = oDocument.CreateStyle("CustomTableStyle", "table");
oTableStyle.SetBasedOn(oDocument.GetStyle("Bordered - Accent 5"));
oTable = Api.CreateTable(2, 2);
oTable.SetWidth("percent", 100);
oTable.SetStyle(oTableStyle);
oDocument.Push(oTable);
builder.SaveFile("docx", "SetBasedOn.docx");
builder.CloseFile();

Resulting document