Get Started
Usage API
More information

SetColumnBackgroundColor

SetColumnBackgroundColor(r, g, b, bNone) → { boolean }

Sets the background color to all cells in the column containing the current cell.

Parameters:

Name Type Description
r byte

Red color component value.

g byte

Green color component value.

b byte

Blue color component value.

bNone boolean

Defines that background color will not be set.

Returns:

Type
boolean

Example

Copy code
builder.CreateFile("docx");
var oDocument = Api.GetDocument();
var oTableStyle = oDocument.CreateStyle("CustomTableStyle", "table");
oTableStyle.SetBasedOn(oDocument.GetStyle("Bordered - Accent 5"));
var oTable = Api.CreateTable(4, 2);
oTable.SetWidth("percent", 100);
oTable.SetStyle(oTableStyle);
var oCell = oTable.GetRow(0).GetCell(0);
oCell.SetColumnBackgroundColor(255, 255, 0, false);
oDocument.Push(oTable);
builder.SaveFile("docx", "SetColumnBackgroundColor.docx");
builder.CloseFile();

Resulting document