Get Started
Documentation

SetTextPr

SetTextPr(oTextPr) → { ApiRange | null }

Sets the text properties of the current Range.

Parameters:

Name Type Description
oTextPr ApiTextPr

Returns:

Type
ApiRange | null

Example

Copy code
builder.CreateFile("docx");
oDocument = Api.GetDocument();
oParagraph = oDocument.GetElement(0);
oParagraph.AddText("ONLYOFFICE Document Builder");
oTextPr = oParagraph.GetTextPr();
oTextPr.SetItalic(true);
oRange = oDocument.GetRange(0, 24);
oRange.SetTextPr(oTextPr);
builder.SaveFile("docx", "SetTextPr.docx");
builder.CloseFile();