The requested page is not available for the requested platform. You are viewing the content for .NET Framework 4.5.2+ platform.
.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+
.NET Core 3.0+

DocumentPosition Class

A position within a document.

Namespace: DevExpress.XtraRichEdit.API.Native

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

Declaration

[ComVisible(true)]
public abstract class DocumentPosition :
    IComparable<DocumentPosition>
<ComVisible(True)>
Public MustInherit Class DocumentPosition
    Implements IComparable(Of DocumentPosition)
[ComVisible(true)]
public abstract class DocumentPosition :
    IComparable<DocumentPosition>
<ComVisible(True)>
Public MustInherit Class DocumentPosition
    Implements IComparable(Of DocumentPosition)
[ComVisible(true)]
public abstract class DocumentPosition :
    IComparable<DocumentPosition>
<ComVisible(True)>
Public MustInherit Class DocumentPosition
    Implements IComparable(Of DocumentPosition)

Remarks

Use the Document.CaretPosition property to get the current cursor (caret) position. The RichEditControl.GetPositionFromPoint method allows you to convert mouse coordinates to a document position.

The DocumentRange.Start and DocumentRange.End positions define a DocumentRange object.

Use the SubDocument.CreatePosition method to obtain an arbitrary position in a document. Call the DocumentPosition.ToInt method to convert a DocumentPosition object to an integer position.

The code sample below obtains a range that starts from the retrieved position:

Document document = server.Document;
document.LoadDocument("Documents\\Grimm.docx", DocumentFormat.OpenXml);
DocumentPosition myStart = document.CreatePosition(69);
DocumentRange myRange = document.CreateRange(myStart, 216);

Inheritance

Object
DocumentPosition
See Also