Ticket Q460647
Visible to All Users

How to iterate through all hyperlinks within a document

created 11 years ago

Hello,
We needed to harvest all of the hyperlinks inside the RTF easily. It would great if you guys add a way to iterate all hyperlinks such as "foreach(Hyperlink link in control.Hyperlinks)…" etc…

Answers approved by DevExpress Support

created 11 years ago (modified 11 years ago)

Hi Clint,
You can iterate through all hyperlinks within a document by using the RichEditControl.Document.Hyperlinks collection.
Look at the following code snippet:

C#
foreach(Hyperlink item in richEditControl1.Document.Hyperlinks) { string hlText = richEditControl1.Document.GetText(item.Range); }
    Comments (2)
    G G
    Government Data Miner 5 years ago

      The hyperlink collection is not sorted by document range.  Is it possible to sort this collection by range?

      DevExpress Support Team 5 years ago

        Hello,

        I've created a separate ticket on your behalf (T833558: How to sort the hyperlink collection by hyperlink positions). It has been placed in our processing queue and will be answered shortly.

        Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

        Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.