TRY NEW VERSION

Try now New API BETA

Try out the new view and capabilities of the API documentation

START

SetColor

SetColor(r, g, b, [isAuto]) → { ApiRange | null }

Sets the text color to the current text Range in the RGB format.

Parameters:

Name Type Default Description
r byte

Red color component value.

g byte

Green color component value.

b byte

Blue color component value.

isAuto boolean false

If this parameter is set to "true", then r,g,b parameters will be ignored.

Returns:

Type
ApiRange | null

Example

Copy code
builder.CreateFile("docx");
var oDocument = Api.GetDocument();
var oParagraph = oDocument.GetElement(0);
oParagraph.AddText("ONLYOFFICE Document Builder");
var oRange = oDocument.GetRange(0, 24);
oRange.SetColor(255, 111, 61);
builder.SaveFile("docx", "SetColor.docx");
builder.CloseFile();

Resulting document