SetFontFamily

function SetFontFamily(sFontFamily: string = null): ApiRange | "null"

Description

Sets all 4 font slots with the specified font family.

Parameters

sFontFamilystringdefault: null

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

Returns

ApiRange | "null"

Try It

var oDocument = Api.GetDocument();
var 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'.");
var oRange = oDocument.GetRange(22, 71);
oRange.SetFontFamily("Consolas");

Get Help

  • If you have any questions about ONLYOFFICE Docs, try the FAQ section first.
  • You can request a feature or report a bug by posting an issue on GitHub.
  • You can also ask our developers on ONLYOFFICE forum (registration required).