SetColor
Sets the text color to the current text run 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
-
ApiTextPr
Example
Copy code
builder.CreateFile("docx");
var oDocument = Api.GetDocument();
var oTextPr = oDocument.GetDefaultTextPr();
oTextPr.SetColor(255, 111, 61, false);
var oParagraph = oDocument.GetElement(0);
oParagraph.AddText("A sample text with the color set to orange using the text properties.");
builder.SaveFile("docx", "SetColor.docx");
builder.CloseFile();
Resulting document