SetBackgroundColor

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

Sets the background color to the current block content control.

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 oBlockLvlSdt = Api.CreateBlockLvlSdt();
oBlockLvlSdt.GetContent().GetElement(0).AddText("This is a block text content control.");
oBlockLvlSdt.SetBackgroundColor(255, 111, 61);
oDocument.AddElement(0, oBlockLvlSdt);
builder.SaveFile("docx", "SetBackgroundColor.docx");
builder.CloseFile();

Resulting document