Get Started
Usage API
More information

SetFill

SetFill(oApiFill)

Set the text color for the current text run.

Parameters:

Name Type Description
oApiFill ApiFill

The color or pattern used to fill the text color.

Returns:

This method doesn't return any data.

Example

Copy code
builder.CreateFile("docx");
oDocument = Api.GetDocument();
oParagraph = oDocument.GetElement(0);
oFill = Api.CreateSolidFill(Api.CreateRGBColor(0, 0, 255));
oTextPr = oDocument.GetDefaultTextPr();
oTextPr.SetFill(oFill);
oParagraph.AddText("This is a text run with the font color set to blue.");
oParagraph.SetTextPr(oTextPr);
builder.SaveFile("docx", "SetFill.docx");
builder.CloseFile();

Resulting document