TRY NEW VERSION

Try now New API BETA

Try out the new view and capabilities of the API documentation

START

SetFillColor

SetFillColor(oColor)

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:

Name Type Description
oColor ApiColor

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

Returns:

This method doesn't return any data.

Example

Copy code
builder.CreateFile("xlsx");
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");
builder.SaveFile("xlsx", "SetFillColor.xlsx");
builder.CloseFile();

Resulting document