SetBackgroundColor

function SetBackgroundColor(r: byte = null, g: byte = null, b: byte = null, bNone: boolean = null): boolean

Description

Sets the background color to all cells in the current table.

Parameters

rbytedefault: null

Red color component value.

gbytedefault: null

Green color component value.

bbytedefault: null

Blue color component value.

bNonebooleandefault: null

Defines that background color will not be set.

Returns

boolean

Try It

var oDocument = Api.GetDocument();
var oTableStyle = oDocument.CreateStyle("CustomTableStyle", "table");
oTableStyle.SetBasedOn(oDocument.GetStyle("Bordered"));
var oTable = Api.CreateTable(4, 2);
oTable.SetWidth("percent", 100);
oTable.SetStyle(oTableStyle);
oTable.SetBackgroundColor(255, 111, 61, false);
oDocument.Push(oTable);

Get Help

  • If you have any questions about ONLYOFFICE Docs, try the FAQ section first.
  • You can request a feature or report a bug by posting an issue on GitHub.
  • You can also ask our developers on ONLYOFFICE forum (registration required).