ApiTextPr

new ApiTextPr()

Class representing the text properties.

Methods

Name Description
GetBold

Gets the bold property from the current text properties.

GetCaps

Specifies whether the text with the current text properties are capitalized.

GetClassType

Returns a type of the ApiTextPr class.

GetDoubleStrikeout

Gets the double strikeout property from the current text properties.

GetFill

Gets the text color from the current text properties.

GetFontFamily

Gets the font family from the current text properties.

GetFontSize

Gets the font size from the current text properties.

GetHighlight

Gets the highlight property from the current text properties.

GetItalic

Gets the italic property from the current text properties.

GetOutLine

Gets the text outline from the current text properties.

GetSmallCaps

Specifies whether the text with the current text properties are displayed capitalized two points smaller than the actual font size.

GetSpacing

Gets the text spacing from the current text properties measured in twentieths of a point.

GetStrikeout

Gets the strikeout property from the current text properties.

GetTextFill

Gets the text fill from the current text properties.

GetUnderline

Gets the underline property from the current text properties.

SetBold

Sets the bold property to the text character.

SetCaps

Specifies that any lowercase characters in the text run are formatted for display only as their capital letter character equivalents.

SetDoubleStrikeout

Specifies that the contents of the run are displayed with two horizontal lines through each character displayed on the line.

SetFill

Sets the text color to the current text run.

SetFontFamily

Sets all 4 font slots with the specified font family.

SetFontSize

Sets the font size to the characters of the current text run.

SetHighlight

Specifies a highlighting color which is added to the text properties and applied as a background to the contents of the current run/range/paragraph.

SetItalic

Sets the italic property to the text character.

SetOutLine

Sets the text outline to the current text run.

SetSmallCaps

Specifies that all the small letter characters in the text run are formatted for display only as their capital letter character equivalents which are two points smaller than the actual font size specified for this text.

SetSpacing

Sets the text spacing measured in twentieths of a point.

SetStrikeout

Specifies that the contents of the run are displayed with a single horizontal line through the center of the line.

SetTextFill

Sets the text fill to the current text run.

SetUnderline

Specifies that the contents of the 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

Specifies the alignment which will be applied to the contents of the 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");
var oPresentation = Api.GetPresentation();
var oSlide = oPresentation.GetSlideByIndex(0);
oSlide.RemoveAllObjects();
var oFill = Api.CreateSolidFill(Api.CreateRGBColor(255, 111, 61));
var oStroke = Api.CreateStroke(0, Api.CreateNoFill());
var oShape = Api.CreateShape("flowChartMagneticTape", 300 * 36000, 130 * 36000, oFill, oStroke);
oShape.SetPosition(608400, 1267200);
var oDocContent = oShape.GetDocContent();
var oParagraph = oDocContent.GetElement(0);
var oRun = Api.CreateRun();
var oTextPr = oRun.GetTextPr();
oTextPr.SetFontSize(30);
oTextPr.SetCaps(true);
oTextPr.SetBold(true);
oFill = Api.CreateSolidFill(Api.CreateRGBColor(51, 51, 51));
oTextPr.SetFill(oFill);
oTextPr.SetFontFamily("Comic Sans MS");
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.");
oRun.AddLineBreak();
var sClassType = oTextPr.GetClassType();
oRun.AddText("Class Type = " + sClassType);
oParagraph.AddElement(oRun);
oSlide.AddObject(oShape);
builder.SaveFile("pptx", "ApiTextPr.pptx");
builder.CloseFile();

Resulting document