officefileapi-devexpress-dot-spreadsheet-dot-shapetextrange-dot-addbefore-x28-system-dot-string-x29.md
Inserts a new text range before the current ShapeTextRange object.
Namespace : DevExpress.Spreadsheet
Assembly : DevExpress.Spreadsheet.v25.2.Core.dll
NuGet Package : DevExpress.Spreadsheet.Core
ShapeTextRange AddBefore(
string text
)
Function AddBefore(
text As String
) As ShapeTextRange
| Name | Type | Description |
|---|---|---|
| text | String |
A string value that is the range’s content.
|
| Type | Description |
|---|---|
| ShapeTextRange |
A ShapeTextRange object that is the new text range.
|
The font and paragraph properties of a ShapeTextRange object created by the AddBefore method call are equal to the existing text range’s options. Use the ShapeTextRange.Font and ShapeTextRange.ParagraphFormat properties to access the range’s font and paragraph settings.
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