Skip to main content

SetBackgroundColor

Sets the background color to the current table cell.

Syntax

expression.SetBackgroundColor(r, g, b, bNone);

expression - A variable that represents a ApiTableCell class.

Parameters

NameRequired/OptionalData typeDefaultDescription
rRequiredbyteRed color component value.
gRequiredbyteGreen color component value.
bRequiredbyteBlue color component value.
bNoneRequiredbooleanDefines that background color will not be set.

Returns

boolean

Example

This example sets the background color to the table cell.

let doc = Api.GetDocument();
let tableStyle = doc.CreateStyle("CustomTableStyle", "table");
tableStyle.SetBasedOn(doc.GetStyle("Bordered"));
let table = Api.CreateTable(4, 2);
table.SetWidth("percent", 100);
table.SetStyle(tableStyle);
let cell = table.GetRow(0).GetCell(0);
cell.SetBackgroundColor(255, 111, 61, false);
doc.Push(table);