Skip to main content

GetDefaultStyle

Returns the default style parameters for the specified document element.

Syntax

expression.GetDefaultStyle(sStyleType);

expression - A variable that represents a ApiDocument class.

Parameters

NameRequired/OptionalData typeDefaultDescription
sStyleTypeRequiredStyleTypeThe document element which we want to get the style for.

Returns

ApiStyle

Example

Get the default style parameters for the specified document element in a document.

// How to get default style of a document element indicating its name.

// Update the default style of the paragraph element in a document.

let doc = Api.GetDocument();
let paragraph = doc.GetElement(0);
let paraPr = doc.GetDefaultParaPr();
paraPr.SetSpacingLine(276, "auto");
paraPr.SetSpacingAfter(200);
let normalStyle = doc.GetDefaultStyle("paragraph");
paraPr = normalStyle.GetParaPr();
paraPr.SetSpacingLine(240, "auto");
paraPr.SetJc("both");
paragraph.AddText("This is just a text.");