Back to Devexpress

ReadOnlyHyperlinkCollection Interface

officefileapi-devexpress-dot-xtrarichedit-dot-api-dot-native-88bd99a4.md

latest3.1 KB
Original Source

ReadOnlyHyperlinkCollection Interface

A collection of Hyperlink objects in the document.

Namespace : DevExpress.XtraRichEdit.API.Native

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

NuGet Package : DevExpress.RichEdit.Core

Declaration

csharp
[ComVisible(true)]
public interface ReadOnlyHyperlinkCollection :
    ISimpleCollection<Hyperlink>,
    IEnumerable<Hyperlink>,
    IEnumerable,
    ICollection
vb
<ComVisible(True)>
Public Interface ReadOnlyHyperlinkCollection
    Inherits ISimpleCollection(Of Hyperlink),
             IEnumerable(Of Hyperlink),
             IEnumerable,
             ICollection

The following members return ReadOnlyHyperlinkCollection objects:

Remarks

Contains a ReadOnlyHyperlinkCollection.Get method that obtains all hyperlinks located in the specified document range. You can access individual items of this collection, but you cannot add or delete items. Use index notation to obtain an individual Hyperlink object from this collection.

The code sample below locates and removes all hyperlinks in the first section:

csharp
using (RichEditDocumentServer wordProcessor = new RichEditDocumentServer())
{
    Document document = wordProcessor.Document;
    ReadOnlyHyperlinkCollection hyperlinks = document.Hyperlinks.Get(document.Sections[0].Range);
    if (hyperlinks != null)
    {
        foreach (Hyperlink hyperlink in hyperlinks)
        {
            document.Hyperlinks.Remove(hyperlink);
        }
    }
}
vb
Using wordProcessor As New RichEditDocumentServer()
    Dim document As Document = wordProcessor.Document
    Dim hyperlinks As ReadOnlyHyperlinkCollection = document.Hyperlinks.Get(document.Sections(0).Range)
    If hyperlinks IsNot Nothing Then
        For Each hyperlink As Hyperlink In hyperlinks
            document.Hyperlinks.Remove(hyperlink)
        Next hyperlink
    End If
End Using

See Also

ReadOnlyHyperlinkCollection Members

Hyperlinks and Bookmarks in Rich Text Documents

DevExpress.XtraRichEdit.API.Native Namespace