Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

Selection

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);
Cursor
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