跳到主要内容

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

This example shows how to get the default style parameters for the specified document element.

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.");