SetTableCellPr
Sets the table cell properties to the current table style properties.
Syntax
expression.SetTableCellPr(oTableCellPr);
expression - A variable that represents a ApiTableStylePr class.
Parameters
| Name | Required/Optional | Data type | Default | Description |
|---|---|---|---|---|
| oTableCellPr | Required | ApiTableCellPr | The table cell properties that will be set. |
Returns
Example
This example shows how to create and set the table cell properties which will be applied to all the cells within a table which match the conditional formatting type.
- Code
- Result
// How to set the table cell properties to table style.
// Update the table style table cell properties.
let doc = Api.GetDocument();
let paragraph = doc.GetElement(0);
paragraph.AddText("We create a 3x3 table and set the gray shading for cell #1:");
let tableStyle = doc.CreateStyle("CustomTableStyle", "table");
tableStyle.SetBasedOn(doc.GetStyle("Bordered"));
let table = Api.CreateTable(3, 3);
table.SetWidth("percent", 100);
let tableStylePr = tableStyle.GetConditionalTableStyle("topLeftCell");
table.SetTableLook(true, true, true, true, true, true);
let tableCellPr = Api.CreateTableCellPr();
tableCellPr.SetShd("clear", 0xEE, 0xEE, 0xEE);
tableStylePr.SetTableCellPr(tableCellPr);
table.SetStyle(tableStyle);
doc.Push(table);