SetFillColor

function SetFillColor(oColor: ApiColor = null): void

Description

Sets the background color to the current cell range with the previously created color object. Sets 'No Fill' when previously created color object is null.

Parameters

oColorApiColordefault: null

The color object which specifies the color to be set to the background in the cell / cell range.

Returns

void

Try It

var oWorksheet = Api.GetActiveSheet();
oWorksheet.SetColumnWidth(0, 50);
oWorksheet.GetRange("A2").SetFillColor(Api.CreateColorFromRGB(255, 213, 191));
oWorksheet.GetRange("A2").SetValue("This is the cell with a color set to its background");
oWorksheet.GetRange("A4").SetValue("This is the cell with a default background color");

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).