Back to Devexpress

ShapeFormat.HasText Property

officefileapi-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-shapeformat.md

latest2.5 KB
Original Source

ShapeFormat.HasText Property

Indicates whether a shape contains text.

Namespace : DevExpress.XtraRichEdit.API.Native

Assembly : DevExpress.RichEdit.v25.2.Core.dll

NuGet Package : DevExpress.RichEdit.Core

Declaration

csharp
bool HasText { get; }
vb
ReadOnly Property HasText As Boolean

Property Value

TypeDescription
Boolean

true if the shape has text; otherwise, false.

|

Remarks

Use the following properties to determine whether a drawing object is a text box:

The example below displays borders around all text boxes in the document.

csharp
Document document = richEditControl.Document;
document.LoadDocument("FirstLook.docx", DocumentFormat.Docx);
foreach (Shape s in document.Shapes)
{
    if (s.Type == ShapeType.Shape && s.ShapeFormat.HasText)
    {
        s.Line.Fill.SetSolidFill(Color.DeepSkyBlue);
        s.Line.Thickness = 3;
    }
}
vb
Dim document As Document = richEditControl.Document
document.LoadDocument("FirstLook.docx", DocumentFormat.Docx)
For Each s As Shape In document.Shapes
    If s.Type = ShapeType.Shape AndAlso s.ShapeFormat.HasText Then
        s.Line.Fill.SetSolidFill(Color.DeepSkyBlue)
        s.Line.Thickness = 3
    End If
Next s

Use the ShapeCollection.InsertTextBox method to add a text box to a document.

See Also

InsertTextBox

ShapeFormat Interface

ShapeFormat Members

DevExpress.XtraRichEdit.API.Native Namespace