Skip to main content

SubDocument.Hyperlinks Property

Provides access to a collection of hyperlinks in the document.

Namespace: DevExpress.XtraRichEdit.API.Native

Assembly: DevExpress.RichEdit.v24.1.Core.dll

NuGet Packages: DevExpress.RichEdit.Core, DevExpress.Win.Navigation

Declaration

Property Value

Type Description
HyperlinkCollection

A HyperlinkCollection interface which exposes a collection of hyperlinks.

Remarks

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.

Example

The code snippet below finds a specific range in the document and converts it to a hyperlink with the specified URI and tooltip:

RichEditControl_Hyperlinks_Result

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";
  }
}
See Also