GetDefaultStyle
Returns the default style parameters for the specified document element.
Syntax
expression.GetDefaultStyle(sStyleType);
expression - A variable that represents a ApiDocument class.
Parameters
| Name | Required/Optional | Data type | Default | Description |
|---|---|---|---|---|
| sStyleType | Required | StyleType | The document element which we want to get the style for. |
Returns
Example
Retrieve and update the default style for a specific element type in a document.
// How do I look up the built-in style applied to paragraphs by default in a document?
// Override paragraph spacing and alignment at the default style level so every matching element is affected 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.");