Get Started
Documentation

SetFontFamily

SetFontFamily(sFontFamily) → { ApiRange | null }

Set all 4 font slots with the specified font family.

Parameters:

Name Type Description
sFontFamily string

The font family or families used for the current text Range.

Returns:

Type
ApiRange | null

Example

Copy code
builder.CreateFile("docx");
oDocument = Api.GetDocument();
oParagraph = oDocument.GetElement(0);
oParagraph.AddText("This is just a sample text. ");
oParagraph.AddText("This is a text run with the font family set to 'Comic Sans MS'.");
oRange = oDocument.GetRange(22, 71);
oRange.SetFontFamily("Comic Sans MS");
builder.SaveFile("docx", "SetFontFamily.docx");
builder.CloseFile();