SetTextPr
Sets the text properties to the current run.
Syntax
expression.SetTextPr(textPr);
expression - A variable that represents a ApiRichRun class.
Parameters
| Name | Required/Optional | Data type | Default | Description |
|---|---|---|---|---|
| textPr | Required | ApiRichTextPr | The text properties that will be set to the current run. |
Returns
Example
This example sets rich text properties to rich run object.
- Code
- Result
let doc = Api.GetDocument();
let freeTextAnnot = Api.CreateFreeTextAnnot([160, 50, 360, 135]);
let page = doc.GetPage(0);
page.AddObject(freeTextAnnot);
freeTextAnnot.SetIntent("freeTextCallout");
freeTextAnnot.SetCallout([{x: 161, y: 51}, {x: 249, y: 125}, {x: 261, y: 125}]);
freeTextAnnot.SetRectDiff([100, 64, 0.5, 0.5]);
let richContent = freeTextAnnot.GetContent();
let para = richContent.GetElement(0);
let run = para.GetElement(0);
run.AddText("Some example text");
let textPr = Api.CreateRichTextPr();
textPr.SetBold(true);
textPr.SetUnderline(true);
run.SetTextPr(textPr);
console.log(`We set rich text properties to rich run object`);