ApiTextPr
Class representing a text properties.
Methods
Name |
Description |
GetClassType |
Get the type of this class. |
SetBold |
Set the bold property to the text character. |
SetCaps |
Specify that any lowercase characters in this text run are formatted for display only as their capital letter character equivalents. |
SetDoubleStrikeout |
Specify that the contents of this run is displayed with two horizontal lines through each character displayed on the line. |
SetFill |
Set the text color for the current text run. |
SetFontFamily |
Set all 4 font slots with the specified font family. |
SetFontSize |
Set the font size for the characters of the current text run. |
SetItalic |
Set the italic property to the text character. |
SetSmallCaps |
Specify that all small letter characters in this text run are formatted for display only as their capital
letter character equivalents in a font size two points smaller than the actual font size specified for this text. |
SetSpacing |
Set text spacing measured in twentieths of a point. |
SetStrikeout |
Specify that the contents of this run are displayed with a single horizontal line through the center of the line. |
SetUnderline |
Specify that the contents of this run are displayed along with a line appearing directly below the character
(less than all the spacing above and below the characters on the line). |
SetVertAlign |
Specify the alignment which will be applied to the contents of this run in relation to the default appearance of the run text:
- "baseline" - the characters in the current text run will be aligned by the default text baseline.
- "subscript" - the characters in the current text run will be aligned below the default text baseline.
- "superscript" - the characters in the current text run will be aligned above the default text baseline.
|
Example
Copy code
builder.CreateFile("pptx");
oPresentation = Api.GetPresentation();
oSlide = oPresentation.GetSlideByIndex(0);
oSlide.RemoveAllObjects();
oFill = Api.CreateSolidFill(Api.CreateRGBColor(61, 74, 107));
oStroke = Api.CreateStroke(0, Api.CreateNoFill());
oShape = Api.CreateShape("flowChartMagneticTape", 300 * 36000, 130 * 36000, oFill, oStroke);
oShape.SetPosition(608400, 1267200);
oDocContent = oShape.GetDocContent();
oParagraph = oDocContent.GetElement(0);
oRun = Api.CreateRun();
oTextPr = oRun.GetTextPr();
oTextPr.SetFontSize(30);
oParagraph.SetJc("left");
oRun.AddText("This is a sample text inside the shape with the font size set to 15 points using the text properties.");
oParagraph.AddElement(oRun);
oSlide.AddObject(oShape);
builder.SaveFile("pptx", "ApiTextPr.pptx");
builder.CloseFile();
Resulting document