Get Started
Documentation

SetTableLook

SetTableLook(isFirstColumn, isFirstRow, isLastColumn, isLastRow, isHorBand, isVerBand)

Specify the components of the conditional formatting of the referenced table style (if one exists) which will be applied to the set of table rows with the current table-level property exceptions. A table style can specify up to six different optional conditional formats, for example, different formatting for first column, which then can be applied or omitted from individual table rows in the parent table.

The default setting is to apply the row and column banding formatting, but not the first row, last row, first column, or last column formatting.

Parameters:

Name Type Description
isFirstColumn boolean Specifies that the first column conditional formatting will be applied to the table.
isFirstRow boolean Specifies that the first row conditional formatting will be applied to the table.
isLastColumn boolean Specifies that the last column conditional formatting will be applied to the table.
isLastRow boolean Specifies that the last row conditional formatting will be applied to the table.
isHorBand boolean Specifies that the horizontal banding conditional formatting will not be applied to the table.
isVerBand boolean Specifies that the vertical banding conditional formatting will not be applied to the table.

Example

Copy code
builder.CreateFile("docx");
var oDocument = Api.GetDocument();
var oParagraph, oTable, oTableStyle;
oParagraph = oDocument.GetElement(0);
oParagraph.AddText("We set the table look to override the current table style:");
oTableStyle = oDocument.CreateStyle("CustomTableStyle", "table");
oTableStyle.SetBasedOn(oDocument.GetStyle("Bordered - Accent 5"));
oTable = Api.CreateTable(3, 3);
oTable.SetWidth("percent", 100);
oTable.SetStyle(oTableStyle);
oTable.SetTableLook(true, true, true, true, true, true);
oTableStyle.GetConditionalTableStyle("topLeftCell").GetTableCellPr().SetShd("clear", 255, 0, 0);
oDocument.Push(oTable);
builder.SaveFile("docx", "SetTableLook.docx");
builder.CloseFile();

Resulting document