Get Started
Usage API
More information

SetTextPr

SetTextPr(oTextPr) → { ApiTextPr }

Set the text properties for the current run.

Parameters:

Name Type Description
oTextPr ApiTextPr

The text properties that will be set to the run specified.

Returns:

Type
ApiTextPr

Example

Copy code
builder.CreateFile("docx");
oDocument = Api.GetDocument();
oParagraph = oDocument.GetElement(0);
oRun = Api.CreateRun();
oRun.AddText("This is just a sample text.");
oParagraph.AddElement(oRun);
oTextPr = oDocument.GetDefaultTextPr();
oTextPr.SetFontSize(30);
oTextPr.SetBold(true);
oRun.SetTextPr(oTextPr);
builder.SaveFile("docx", "SetTextPr.docx");
builder.CloseFile();

Resulting document