SetBackgroundColor
Sets the background color of the current cell.
Syntax
expression.SetBackgroundColor(color);
expression - A variable that represents an ApiTableCell class.
Parameters
| Name | Required/Optional | Data type | Default | Description |
|---|---|---|---|---|
| color | Optional | ApiColor | If not passed, the background color will be cleared. |
Returns
boolean
Example
Set the background color of a table cell in a PDF.
// Color the background of a single table cell in a PDF.
// Set an orange background for the first cell in a PDF.
const doc = Api.GetDocument();
const page = doc.GetPage(0);
const table = Api.CreateTable(2, 3);
const cell = table.GetRow(0).GetCell(0);
cell.SetBackgroundColor(Api.RGB(255, 111, 61));
page.AddObject(table);