Skip to main content

SelectionCollection.Unselect(DocumentRange) Method

Unselects a specified range.

Namespace: DevExpress.XtraRichEdit.API.Native

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

NuGet Packages: DevExpress.RichEdit.Core, DevExpress.Win.Navigation

Declaration

public void Unselect(
    DocumentRange range
)

Parameters

Name Type Description
range DocumentRange

A DocumentRange to unselect.

Remarks

If the specified range is partially selected (intersects with selected ranges), selections are updated so that the specified range is not selected. If the specified range is not selected, it remains unselected.

Example

View Example

using DevExpress.XtraRichEdit;
using DevExpress.XtraRichEdit.API.Native;

static void UnselectRangeExample1(Document document) {
    document.LoadDocument("SelectionCollection.docx", DocumentFormat.OpenXml);
    int startPos = 80;
    int endPos = document.Tables[0].Rows[1].LastCell.ContentRange.Start.ToInt();
    DocumentRange myRange = document.CreateRange(startPos, endPos - startPos);
    document.Selections.Add(myRange);
    DocumentRange unselectRange = document.CreateRange(140, 200);
    document.Selections.Unselect(unselectRange);
}

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the Unselect(DocumentRange) method.

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.

See Also