SetTextPr
Sets the text properties to the current style.
Syntax
expression.SetTextPr(oTextPr);
expression - A variable that represents a ApiStyle class.
Parameters
| Name | Required/Optional | Data type | Default | Description |
|---|---|---|---|---|
| oTextPr | Required | ApiTextPr | The text properties that will be set. |
Returns
Example
This example applies text settings to the specified style.
- Code
- Result
// Creates a paragraph, adds a text to it, and sets the font size and bold property to this text.
// Specifies the ApiTextPr object and applies its settings to the ApiStyle object.
let doc = Api.GetDocument();
let normalStyle = doc.GetDefaultStyle("paragraph");
let textPr = Api.CreateTextPr();
textPr.SetFontSize(30);
textPr.SetBold(true);
normalStyle.SetTextPr(textPr);
let paragraph = doc.GetElement(0);
paragraph.AddText("This is a paragraph with the text color, font family and font size set using the text style. ");
paragraph.AddText("We do not change the style of the paragraph itself. ");
paragraph.AddText("Only document-wide text styles are applied.");