Get Started
Documentation

SetColor

SetColor(r, g, b, [isAuto]) → { ApiParagraph }

Set the text color for the current paragraph 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
ApiParagraph

Example

Copy code
builder.CreateFile("docx");
oDocument = Api.GetDocument();
oParagraph = oDocument.GetElement(0);
oParagraph.AddText("This is a paragraph with the font color set to blue.");
oParagraph.SetColor(0, 0, 255);
builder.SaveFile("docx", "SetColor.docx");
builder.CloseFile();