officefileapi-devexpress-dot-spreadsheet-dot-shapetext-28393d3d.md
Gets or sets the vertical alignment of a shape text.
Namespace : DevExpress.Spreadsheet
Assembly : DevExpress.Spreadsheet.v25.2.Core.dll
NuGet Package : DevExpress.Spreadsheet.Core
ShapeTextVerticalAnchorType VerticalAnchor { get; set; }
Property VerticalAnchor As ShapeTextVerticalAnchorType
| Type | Description |
|---|---|
| ShapeTextVerticalAnchorType |
A ShapeTextVerticalAnchorType enumeration values indicating the text’s vertical alignment.
|
Available values:
| Name | Description |
|---|---|
| Bottom |
Specifies a bottom-aligned shape text.
| | Center |
Specifies a center-aligned shape text.
| | Distributed |
Specifies that the shape text is distributed to fill the entire text frame.
| | Justified |
Specifies a fully justified shape text.
| | Top |
Specifies a top-aligned shape text.
|
The VerticalAnchor property allows you specify the text alignment within a shape. Use the ShapeText.HorizontalAnchor property to define the shape text’s horizontal alignment.
Specify the ShapeTextParagraphFormat options to define the alignment of a specific shape text’s part. Use the ShapeTextRange.ParagraphFormat property to access these options.
ShapeText shapeText = shape4.ShapeText;
//Create a text range:
ShapeTextRange range = shapeText.Characters();
//Specify the shape's text
range.Text = "Shape ";
//Set font properties:
range.Font.Bold = true;
range.Font.Color = Color.YellowGreen;
//Add new text range after the existing text
//And specify the font parameters:
ShapeTextRange range2 = range.AddAfter("Text");
range2.Font.Italic = true;
range2.Font.Name = "Arial";
range2.Font.Color = Color.BurlyWood;
//Define the text's vertical and horizontal alignment:
shapeText.VerticalAnchor = ShapeTextVerticalAnchorType.Center;
shapeText.HorizontalAnchor = ShapeTextHorizontalAnchorType.Center;
Dim shapeText As ShapeText = shape4.ShapeText
'Create a text range:
Dim range As ShapeTextRange = shapeText.Characters()
'Specify the shape's text:
range.Text = "Shape "
'Set font properties:
range.Font.Bold = True
range.Font.Color = Color.YellowGreen
'Add new text range after the existing text
' And specify the font parameters:
Dim range2 As ShapeTextRange = range.AddAfter("Text")
range2.Font.Italic = True
range2.Font.Name = "Arial"
range2.Font.Color = Color.BurlyWood
'Define the text's vertical and horizontal alignment:
shapeText.VerticalAnchor = ShapeTextVerticalAnchorType.Center
shapeText.HorizontalAnchor = ShapeTextHorizontalAnchorType.Center
See Also