Click or drag to resize

Hyperlink Class

Represents a hyperlink.
Inheritance Hierarchy

Namespace:  SautinSoft.Document
Assembly:  SautinSoft.Document (in SautinSoft.Document.dll) Version:
public sealed class Hyperlink : Inline, 

The Hyperlink type exposes the following members.

Public propertyCode exampleAddress
Gets or sets the hyperlink address.
Public propertyContent
Gets the ContentRange of the current element.
(Inherited from Element.)
Public propertyCode exampleDisplayInlines
Gets the hyperlink display Inlines.
Public propertyDocument
Gets the owner document.
(Inherited from Element.)
Public propertyElementType
Gets the ElementType of this element instance.
(Overrides ElementElementType.)
Public propertyIsBookmarkLink
Gets or sets a value indicating whether this Hyperlink instance is bookmark link.
Public propertyNextSibling
Gets the next Element sibling.
(Inherited from Element.)
Public propertyParent
Gets the parent of this element instance.
(Inherited from Element.)
Public propertyParentCollection
Gets the InlineCollection that contains this Inline instance.
(Inherited from Inline.)
Public propertyPreviuosSibling
Gets the previous Element sibling.
(Inherited from Element.)
Public propertyRevision
Gets the revision info.
(Inherited from Inline.)
Public propertyCode exampleScreenTip
Gets or sets the screen tip.
Public propertyTargetFrame
Gets or sets the target frame.
Public methodAncestors (Inherited from Element.)
Public methodClone
Clones this Hyperlink instance, and optionally clones it's display elements.
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Public methodCode exampleGetChildElements(Boolean)
Gets the child elements.
(Inherited from Element.)
Public methodCode exampleGetChildElements(Boolean, ElementType)
Gets the child elements filtered by ElementType.
(Inherited from Element.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Explicit Interface Implementations
How to add a hyperlink into a document in C#
using SautinSoft.Document;

namespace Sample
    class Sample
        static void Main(string[] args)

        /// <summary>
        /// How to add a hyperlink into a document. 
        /// </summary>
        /// <remarks>
        /// Details:
        /// </remarks>        
        public static void AddHyperlink()
            string docxPath = @"Hyperlink.docx";

            // Let's create a simple DOCX document with a hyperlink.
            DocumentCore dc = new DocumentCore();

            Hyperlink hpl = new Hyperlink(dc, "", "Welcome to Zoo!");
            (hpl.DisplayInlines[0] as Run).CharacterFormat = new CharacterFormat() { Size = 16, FontColor = new Color("#358CCB"), UnderlineStyle = UnderlineType.Single };
            hpl.ScreenTip = "Welcome to WoodLand Zoo!";

            Paragraph p = new Paragraph(dc);
            p.ParagraphFormat.Alignment = HorizontalAlignment.Center;


            // Save our document to DOCX format.

           // Open the result for demonstration purposes.
            System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(docxPath) { UseShellExecute = true });
How to add a hyperlink into a document in VB.Net
Imports System
Imports System.IO
Imports SautinSoft.Document

Module Sample
    Sub Main()
    End Sub

    ''' <summary>
    ''' How to add a hyperlink into a document. 
    ''' </summary>
    ''' <remarks>
    ''' Details:
    ''' </remarks>        
    Sub AddHyperlink()
        Dim docxPath As String = "Hyperlink.docx"

        ' Let's create a simple DOCX document with a hyperlink.
        Dim dc As New DocumentCore()

        Dim hpl As New Hyperlink(dc, "", "Welcome to Zoo!")
        TryCast(hpl.DisplayInlines(0), Run).CharacterFormat = New CharacterFormat() With {
            .Size = 16,
            .FontColor = New Color("#358CCB"),
            .UnderlineStyle = UnderlineType.Single
        hpl.ScreenTip = "Welcome to WoodLand Zoo!"

        Dim p As New Paragraph(dc)
        p.ParagraphFormat.Alignment = HorizontalAlignment.Center


        ' Save our document to DOCX format.

        ' Open the result for demonstration purposes.
        System.Diagnostics.Process.Start(New System.Diagnostics.ProcessStartInfo(docxPath) With {.UseShellExecute = True})
    End Sub
End Module
See Also