Skip to main content

SetFontSize

Sets the font size to the characters of the current text Range.

Syntax

expression.SetFontSize(FontSize);

expression - A variable that represents a ApiRange class.

Parameters

NameRequired/OptionalData typeDefaultDescription
FontSizeRequiredhpsThe text size value measured in half-points (1/144 of an inch).

Returns

ApiRange | null

Example

Change the text size for a range of characters in a document.

// How do I make a section of text larger or smaller in a document?

// Resize the letters in a chosen portion of text to stand out or fit better in a document.

let doc = Api.GetDocument();
let paragraph = doc.GetElement(0);
paragraph.AddText("ONLYOFFICE Document Builder");
let range = doc.GetRange(0, 24);
range.SetFontSize(14);