Back to Devexpress

HyperlinkCollection.Remove(Hyperlink) Method

officefileapi-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-hyperlinkcollection-dot-remove-x28-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-hyperlink-x29.md

latest2.7 KB
Original Source

HyperlinkCollection.Remove(Hyperlink) Method

Converts a hyperlink to plain text.

Namespace : DevExpress.XtraRichEdit.API.Native

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

NuGet Package : DevExpress.RichEdit.Core

Declaration

csharp
void Remove(
    Hyperlink hyperlink
)
vb
Sub Remove(
    hyperlink As Hyperlink
)

Parameters

NameTypeDescription
hyperlinkHyperlink

A Hyperlink to convert.

|

Example

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

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

using (var wordProcessor = new RichEditDocumentServer())
{
    // Load a document
    wordProcessor.LoadDocument("Documents//Document.docx");
    Document document = wordProcessor.Document;

    // Obtain all hyperlinks in the first section
    var hyperlinks = document.Hyperlinks.Get(document.Sections[0].Range);
    if (hyperlinks != null)
    {
        // Remove all hyperlinks
        foreach (Hyperlink hyperlink in hyperlinks)
        {
            document.Hyperlinks.Remove(hyperlink);
        }
    }
}
vb
Imports DevExpress.XtraRichEdit
Imports DevExpress.XtraRichEdit.API.Native

Using wordProcessor = New RichEditDocumentServer()
    ' Load a document
    wordProcessor.LoadDocument("Documents//Document.docx")
    Dim document As Document = wordProcessor.Document

    ' Obtain all hyperlinks in the first section
    Dim hyperlinks = document.Hyperlinks.Get(document.Sections(0).Range)
    If hyperlinks IsNot Nothing Then
        ' Remove all hyperlinks
        For Each hyperlink As Hyperlink In hyperlinks
            document.Hyperlinks.Remove(hyperlink)
        Next hyperlink
    End If
End Using

See Also

HyperlinkCollection Interface

HyperlinkCollection Members

DevExpress.XtraRichEdit.API.Native Namespace