The RichEdit client API available using the selection property allows you to access and modify selections in a document.

The control keeps the following information about selection:

Example: in the image below, three intervals are selected. The last interval is selected from right to left. In this case, the properties return the following values.

Selection Positions

Set Selection

Selection API allows you to set a cursor position (selection with zero length), select a document interval, multiple intervals, or the entire sub-document. The table below lists methods that allow you to set selection.

Selected element Method Example
Set the cursor position setSelection(position) richEdit.selection.setSelection(5);
Select an interval setSelection(interval) richEdit.selection.setSelection(new DevExpress.RichEdit.Interval(4, 10));
Selected Interval
Select several intervals setSelection(interval[]) richEdit.selection.setSelection([{start: 0, length: 3}, {start: 28, length: 9}]);
Selected Intervals
Select the entire sub-document selectAll richEdit.selection.selectAll();
Selected Document
See Also