Back to Devexpress

Shape.Range Property

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

latest3.9 KB
Original Source

Shape.Range Property

Returns the anchoring range for a shape.

Namespace : DevExpress.XtraRichEdit.API.Native

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

NuGet Package : DevExpress.RichEdit.Core

Declaration

csharp
DocumentRange Range { get; }
vb
ReadOnly Property Range As DocumentRange

Property Value

TypeDescription
DocumentRange

A range to which the shape is anchored.

|

Remarks

A shape is anchored to a document range, but you can position it anywhere on the page that contains the shape’s anchor. The pos parameter of the ShapeCollection.Insert method specifies the anchor’s position within the document. The anchor sign appears at the beginning of the paragraph that contains the anchor.

A shape always remains on the same page as its anchor. If the Shape.LockAnchor property is true , you cannot move the anchor to a different position on the page.

Tip

To select a shape, assign its Range to the Document.Selection property.

The following code snippets (auto-collected from DevExpress Examples) contain references to the Range property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

winforms-richedit-document-api/CS/RichEditAPISample/CodeExamples/Shapes.cs#L118

csharp
document.LoadDocument("Documents//Grimm.docx", DevExpress.XtraRichEdit.DocumentFormat.OpenXml);
document.Selection = document.Shapes[0].Range;
#endregion #SelectShape

word-document-api-examples/CS/CodeExamples/ShapesActions.cs#L199

csharp
// Select the second drawing object in the shape collection.
    document.Selection = document.Shapes[1].Range;
}

winforms-richedit-document-api/VB/RichEditAPISample/CodeExamples/Shapes.vb#L102

vb
document.LoadDocument("Documents//Grimm.docx", DevExpress.XtraRichEdit.DocumentFormat.OpenXml)
            document.Selection = document.Shapes(CInt((0))).Range
#End Region ' #SelectShape

word-document-api-examples/VB/CodeExamples/ShapesActions.vb#L159

vb
' Select the second drawing object in the shape collection.
    document.Selection = document.Shapes(CInt((1))).Range
End If

See Also

Shape Interface

Shape Members

DevExpress.XtraRichEdit.API.Native Namespace