Skip to main content

GetStyle

Returns a style by its name.

Syntax

expression.GetStyle(sStyleName);

expression - A variable that represents a ApiDocument class.

Parameters

NameRequired/OptionalData typeDefaultDescription
sStyleNameRequiredstringThe style name.

Returns

ApiStyle

Example

This example shows how to get a style by its name.

let doc = Api.GetDocument();
let noSpacingStyle = doc.GetStyle("Heading 6");
let paragraph = doc.GetElement(0);
paragraph.SetStyle(noSpacingStyle);
paragraph.AddText("This is a text in a paragraph styled with the 'Heading 6' style.");