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("xlsx");
oWorksheet = Api.GetActiveSheet();
oFill = Api.CreateSolidFill(Api.CreateRGBColor(104, 155, 104));
oStroke = Api.CreateStroke(0, Api.CreateNoFill());
oShape = oWorksheet.AddShape("flowChartOnlineStorage", 120 * 36000, 70 * 36000, oFill, oStroke, 0, 2 * 36000, 0, 3 * 36000);
oDocContent = oShape.GetDocContent();
oParagraph = oDocContent.GetElement(0);
oRun = Api.CreateRun();
oRun.AddText("This is a sample text with the font size set to 15 points and the font weight set to bold.");
oTextPr = oRun.GetTextPr();
oTextPr.SetFontSize(30);
oTextPr.SetBold(true);
oRun.SetTextPr(oTextPr);
oParagraph.AddElement(oRun);
builder.SaveFile("xlsx", "SetTextPr.xlsx");
builder.CloseFile();

Resulting document