Skip to main content

SetVerticalTextAlign

Sets the vertical alignment to the shape content where a paragraph or text runs can be inserted.

Syntax

expression.SetVerticalTextAlign(VerticalAlign);

expression - A variable that represents a ApiShape class.

Parameters

NameRequired/OptionalData typeDefaultDescription
VerticalAlignRequiredVerticalTextAlignThe type of the vertical alignment for the shape inner contents.

Returns

boolean

Example

This example sets the vertical alignment to the shape content where a paragraph or text runs can be inserted.

// How to align the text of the shape to top.

// Set vertical text align to top.

let doc = Api.GetDocument();
let paragraph = doc.GetElement(0);
let fill = Api.CreateSolidFill(Api.CreateRGBColor(255, 111, 61));
let stroke = Api.CreateStroke(0, Api.CreateNoFill());
let drawing = Api.CreateShape("rect", 3212465, 963295, fill, stroke);
paragraph.AddDrawing(drawing);
let docContent = drawing.GetContent();
let classType = drawing.GetClassType();
paragraph = Api.CreateParagraph();
paragraph.AddText("Class Type = " + classType);
docContent.AddElement(0, paragraph);
drawing.SetVerticalTextAlign("top");