officefileapi-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-subdocument-95505622.md
Provides access to a collection of hyperlinks in the document.
Namespace : DevExpress.XtraRichEdit.API.Native
Assembly : DevExpress.RichEdit.v25.2.Core.dll
NuGet Package : DevExpress.RichEdit.Core
HyperlinkCollection Hyperlinks { get; }
ReadOnly Property Hyperlinks As HyperlinkCollection
| Type | Description |
|---|---|
| HyperlinkCollection |
A HyperlinkCollection interface which exposes a collection of hyperlinks.
|
Use the HyperlinkCollection.Create method to add a new hyperlink.
Note
The hyperlink attached to a shape is not added to the HyperlinkCollection. Check the Shape.Hyperlink property to retrieve the hyperlink.
The code snippet below finds a specific range in the document and converts it to a hyperlink with the specified URI and tooltip:
using DevExpress.XtraRichEdit;
using DevExpress.XtraRichEdit.API.Native;
using (var wordProcessor = new RichEditDocumentServer())
{
wordProcessor.LoadDocument("Documents//Document.docx");
Document document = wordProcessor.Document;
// Find a specific text string
DocumentRange[] foundRanges =
document.FindAll("DevExpress WinForms Rich Text Editor",
SearchOptions.CaseSensitive);
if (foundRanges.Length > 0)
{
// Convert the found range to a hyperlink
Hyperlink hyperlink = document.Hyperlinks.Create(foundRanges[0]);
// Specify the URI and the tooltip
hyperlink.NavigateUri =
"https://www.devexpress.com/Products/NET/Controls/WinForms/Rich_Editor/";
hyperlink.ToolTip = "WinForms Rich Text Editor";
}
}
Imports DevExpress.XtraRichEdit
Imports DevExpress.XtraRichEdit.API.Native
Using wordProcessor = New RichEditDocumentServer()
wordProcessor.LoadDocument("Documents//Document.docx")
Dim document As Document = wordProcessor.Document
' Find a specific text string
Dim foundRanges() As DocumentRange =
document.FindAll("DevExpress WinForms Rich Text Editor", SearchOptions.CaseSensitive)
If foundRanges.Length > 0 Then
' Convert the found range to a hyperlink
Dim hyperlink As Hyperlink = document.Hyperlinks.Create(foundRanges(0))
' Specify the URI and the tooltip
hyperlink.NavigateUri =
"https://www.devexpress.com/Products/NET/Controls/WinForms/Rich_Editor/"
hyperlink.ToolTip = "WinForms Rich Text Editor"
End If
End Using
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the Hyperlinks property.
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.
office-file-api-ai-implementation/CS/Controllers/AccessibilityController.cs#L104
{
foreach (var hyperlink in document.Hyperlinks)
{
See Also