Get Started
Documentation

ApiTableStylePr

new ApiTableStylePr()

Class representing a set of formatting properties which will be conditionally applied to the parts of a table matching the requirements specified with the Type parameter.

Methods

Name Description
GetClassType Get the type of this class.
GetParaPr Get the set of the paragraph properties which will be applied to all the paragraphs within a table which match the conditional formatting type.
GetTableCellPr Get the set of the table cell properties which will be applied to all the cells within a table which match the conditional formatting type.
GetTablePr Get the set of the table properties which will be applied to all the regions within a table which match the conditional formatting type.
GetTableRowPr Get the set of the table row properties which will be applied to all the rows within a table which match the conditional formatting type.
GetTextPr Get the 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 Get the type of the current table conditional style.

Example

Copy code
builder.CreateFile("docx");
var oDocument = Api.GetDocument();
var oParagraph, oTable, oTableStyle, oTableStylePr, oParaPr;
oParagraph = oDocument.GetElement(0);
oParagraph.AddText("We create a 3x3 table and set the bold font weight to the text in cell #1:");
oTableStyle = oDocument.CreateStyle("CustomTableStyle", "table");
oTableStyle.SetBasedOn(oDocument.GetStyle("Bordered - Accent 5"));
oTable = Api.CreateTable(3, 3);
oTable.SetWidth("percent", 100);
oTableStylePr = oTableStyle.GetConditionalTableStyle("topLeftCell");
oTable.SetTableLook(true, true, true, true, true, true);
oTableStylePr.GetTextPr().SetBold(true);
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");
oTable.SetStyle(oTableStyle);
oDocument.Push(oTable);
builder.SaveFile("docx", "GetTextPr.docx");
builder.CloseFile();

Resulting document