Get Started
Documentation

SetFillColor

SetFillColor(oColor)

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

Parameters:

Name Type Description
oColor ApiColor

The color object previously created to set the color to the background in the cell/cell range.

Example

Copy code
builder.CreateFile("xlsx");
oWorksheet = Api.GetActiveSheet();
oWorksheet.SetColumnWidth(0, 50);
oWorksheet.GetRange("A2").SetFillColor(Api.CreateColorFromRGB(255, 224, 204));
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");
builder.SaveFile("xlsx", "SetFillColor.xlsx");
builder.CloseFile();

Resulting document