SetBackgroundColor
为当前表格行中的所有单元格设置背景颜色。
语法
expression.SetBackgroundColor(color);
expression - 表示 ApiTableRow 类的变量。
参数
| 名称 | 必需/可选 | 数据类型 | 默认值 | 描述 |
|---|---|---|---|---|
| color | 可选 | ApiColor | 如果未传递,将清除背景颜色。 |
返回值
boolean
示例
在文档中为表格行的每个单元格应用背景颜色。
// How do I fill a table row with a specific background color in a document?
// Highlight an entire row by painting its cells with a chosen color in a document.
let doc = Api.GetDocument();
let tableStyle = doc.CreateStyle("CustomTableStyle", "table");
tableStyle.SetBasedOn(doc.GetStyle("Bordered"));
let table = Api.CreateTable(4, 4);
table.SetWidth("percent", 100);
table.SetStyle(tableStyle);
let tableRow = table.GetRow(1);
tableRow.SetBackgroundColor(Api.HexColor('#FF6F3D'));
doc.Push(table);