Skip to main content
You are viewing help content for a version that is no longer maintained/updated.
All docs
V18.1
  • DevExpress v25.1 Update — Your Feedback Matters

    Our What's New in v25.1 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

    How to: Select Text Programmatically

    Use the Document.Selection property to select a text. The following code snippet illustrates how you can select a range of 69 positions starting from the position 216 in the document:

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