Get Started
Documentation

GetTextPr

GetTextPr() → { ApiTextPr }

Specify the text properties which will be applied to the text in the current numbering level itself, not to the text in the subsequent paragraph. To change the text style for the paragraph, a style must be applied to it using the ApiRun.SetStyle method.

Parameters:

This method doesn't have any parameters.

Returns:

Type
ApiTextPr

Example

Copy code
builder.CreateFile("docx");
oDocument = Api.GetDocument();
oNumbering = oDocument.CreateNumbering("numbered");
oNumLvl = oNumbering.GetLevel(0);
oTextPr = oNumLvl.GetTextPr();
oTextPr.SetBold(true);
oTextPr.SetFontFamily("Calibri");
oTextPr.SetFontSize(28);
oParagraph = oDocument.GetElement(0);
oParagraph.SetNumbering(oNumLvl);
oParagraph.AddText("This is the first element of a numbered list which starts with '1'");
oParagraph = Api.CreateParagraph();
oParagraph.SetNumbering(oNumLvl);
oParagraph.AddText("This is the second element of a numbered list which starts with '2'");
oDocument.Push(oParagraph);
builder.SaveFile("docx", "GetTextPr.docx");
builder.CloseFile();

Resulting document