Get Started
Usage API
More information

ApiTableStylePr

new ApiTableStylePr()

Class representing a set of formatting properties which shall be conditionally applied to the parts of a table which match the requirement specified on the Type.

Methods

Name Description
GetClassType

Returns a type of the ApiTableStylePr class.

GetParaPr

Returns a set of the paragraph properties which will be applied to all the paragraphs within a table which match the conditional formatting type.

GetTableCellPr

Returns a set of the table cell properties which will be applied to all the cells within a table which match the conditional formatting type.

GetTablePr

Returns a set of the table properties which will be applied to all the regions within a table which match the conditional formatting type.

GetTableRowPr

Returns a set of the table row properties which will be applied to all the rows within a table which match the conditional formatting type.

GetTextPr

Returns a set of the text run properties which will be applied to all the text runs within the table which match the conditional formatting type.

GetType

Returns a type of the current table conditional style.

Example

Copy code
builder.CreateFile("docx");
var oDocument = Api.GetDocument();
var oTableStyle = oDocument.CreateStyle("CustomTableStyle", "table");
oTableStyle.SetBasedOn(oDocument.GetStyle("Bordered - Accent 5"));
var oTable = Api.CreateTable(3, 3);
oTable.SetWidth("percent", 100);
var oTableStylePr = oTableStyle.GetConditionalTableStyle("topLeftCell");
oTable.SetTableLook(true, true, true, true, true, true);
oTableStylePr.GetTextPr().SetBold(true);
var oParagraph = oTable.GetRow(0).GetCell(0).GetContent().GetElement(0);
oParagraph.AddText("Bold text");
oParagraph = oTable.GetRow(0).GetCell(1).GetContent().GetElement(0);
oParagraph.AddText("Normal text");
var oParaPr = oTableStylePr.GetParaPr();
oParaPr.SetJc("center");
oTableStylePr.GetTableCellPr().SetShd("clear", 0xEE, 0xEE, 0xEE);
oTableStylePr.GetTableRowPr().SetHeight("atLeast", 720);
oTable.SetStyle(oTableStyle);
oDocument.Push(oTable);
var sClassType = oTableStylePr.GetClassType();
oParagraph = oDocument.GetElement(0);
oParagraph.AddText("Class Type = " + sClassType);
var sTableStylePrType = oTableStylePr.GetType();
oParagraph.AddLineBreak();
oParagraph.AddText("Style type = " + sTableStylePrType);
builder.SaveFile("docx", "ApiTableStylePr.docx");
builder.CloseFile();

Resulting document