跳到主要内容

SetTextPr

Applies text settings to the content of the content control.

Syntax

expression.SetTextPr(textPr);

expression - A variable that represents a ApiBlockLvlSdt class.

Parameters

NameRequired/OptionalData typeDefaultDescription
textPrRequiredApiTextPrThe properties that will be set to the content of the content control.

Returns

This method doesn't return any data.

Example

This example applies text settings to the content of the content control.

let doc = Api.GetDocument();
let blockLvlSdt = Api.CreateBlockLvlSdt();
blockLvlSdt.GetContent().GetElement(0).AddText("This is a block text content control with the font size set to 30 and the font weight set to bold.");
doc.AddElement(0, blockLvlSdt);
let textPr = Api.CreateTextPr();
textPr.SetFontSize(30);
textPr.SetBold(true);
blockLvlSdt.SetTextPr(textPr);