Skip to main content

GetName

Returns the font name property of the specified font.

Syntax

expression.GetName();

expression - A variable that represents a ApiFont class.

Parameters

This method doesn't have any parameters.

Returns

string | null

Example

This example shows how to get the font name property of the specified font.

// How to determine a font name.

// Apply a font to the characters then get its name and add it in the range.

let worksheet = Api.GetActiveSheet();
let range = worksheet.GetRange("B1");
range.SetValue("This is just a sample text.");
let characters = range.GetCharacters(9, 4);
let font = characters.GetFont();
font.SetName("Font 1");
let fontName = font.GetName();
worksheet.GetRange("B3").SetValue("Font name: " + fontName);