Skip to main content

GetStyle

Returns the paragraph style method.

Inherited from ApiParaPr.GetStyle.

Example

Get the paragraph style in a document.

// How to get the style of the paragraph in a document.

// Get the paragraph style and display its name in a document.

let doc = Api.GetDocument();
let heading6Style = doc.GetStyle("Heading 6");
let paragraph = doc.GetElement(0);
let paraPr = paragraph.GetParaPr();
paraPr.SetJc("center");
paraPr.SetStyle(heading6Style);
paragraph.AddText("This is a text in a paragraph styled with the 'Heading 6' style.");
let style = paraPr.GetStyle();
paragraph.AddLineBreak();
paragraph.AddText("Style: " + style.GetName());