Hyperlink Class
Represents an Inline that can be used to create a link to an external resource or to a Bookmark inside a document.
public sealed class Hyperlink : Inline, IContentElement
Public NotInheritable Class Hyperlink
Inherits Inline
Implements IContentElement
- Inheritance:
- System.ObjectHyperlink
Implements
Remarks
Hyperlink is an Inline element. For more information about GemBox.Document Content Model, see content model.
Hyperlink can contain any other Inline element except Hyperlink in its DisplayInlines content property.
For an example how to create a Hyperlink to a Bookmark, see Bookmarks and Hyperlinks example.
Hyperlinks exported to XPS file format do not provide navigational capabilities.
Constructors
Hyperlink(DocumentModel, String, Inline[])
Initializes a new instance of the Hyperlink class.
public Hyperlink(DocumentModel document, string address, params Inline[] displayInlines)
Public Sub New(document As DocumentModel, address As String, ParamArray displayInlines As Inline())
Parameters
document
- DocumentModel
The owner document.
address
- System.String
The address that identifies external resource such as URL, or bookmark name.
Hyperlink(DocumentModel, String, IEnumerable<Inline>)
Initializes a new instance of the Hyperlink class.
public Hyperlink(DocumentModel document, string address, IEnumerable<Inline> displayInlines)
Public Sub New(document As DocumentModel, address As String, displayInlines As IEnumerable(Of Inline))
Parameters
document
- DocumentModel
The owner document.
address
- System.String
The address that identifies external resource such as URL, or bookmark name.
displayInlines
- System.Collections.Generic.IEnumerable<Inline>
The Inline sequence that represents hyperlink display elements.
Hyperlink(DocumentModel, String, String)
Initializes a new instance of the Hyperlink class.
public Hyperlink(DocumentModel document, string address, string displayText)
Public Sub New(document As DocumentModel, address As String, displayText As String)
Parameters
document
- DocumentModel
The owner document.
address
- System.String
The address that identifies external resource such as URL, or bookmark name.
displayText
- System.String
The hyperlink display text.
Properties
Address
Gets or sets the hyperlink address.
Property Value
- System.String
The hyperlink address.
Remarks
Can contain an URI string or a Bookmark name.
DisplayInlines
Gets the hyperlink display Inlines.
public InlineCollection DisplayInlines { get; }
Public ReadOnly Property DisplayInlines As InlineCollection
Property Value
The hyperlink display Inlines.
Remarks
ElementType
Gets the ElementType of this Element instance.
public override ElementType ElementType { get; }
Public Overrides ReadOnly Property ElementType As ElementType
Property Value
The ElementType of this Element instance.
Overrides
IsBookmarkLink
Gets or sets a value indicating whether this Hyperlink instance is bookmark link.
Property Value
- System.Boolean
true if this Hyperlink instance is bookmark link; otherwise, false.
ScreenTip
Gets or sets the screen tip.
Property Value
- System.String
The screen tip.
TargetFrame
Gets or sets the target frame.
Property Value
- System.String
The target frame.
Remarks
Supported values are: _blank, _parent, _self, _top or frame name.
Methods
Clone(Boolean)
Clones this Hyperlink instance, and optionally clones it's display elements.
public Hyperlink Clone(bool cloneDisplay)
Public Function Clone(cloneDisplay As Boolean) As Hyperlink
Parameters
cloneDisplay
- System.Boolean
true to clone hyperlink display elements; otherwise false.
Returns
Remarks
Document content element instance can exist only in a one place in the document.
If you want to insert document content element into some other part of the same document, then clone the element and insert its clone.
If you want to insert document content element into another document, then you should first import it into another document with Import<T>(T, Boolean, Boolean) method and then insert the imported element.
For more information, see cloning example.
CreateHyperlinkStyledRun(DocumentModel, String)
Creates the hyperlink-styled Run.
public static Run CreateHyperlinkStyledRun(DocumentModel document, string text)
Public Shared Function CreateHyperlinkStyledRun(document As DocumentModel, text As String) As Run
Parameters
document
- DocumentModel
The owner document.
text
- System.String
The run text.
Returns
Inherited Properties
Content | Gets the content of the current Element. (Inherited from Element) |
Document | Gets the owner document. (Inherited from Element) |
Parent | Gets the parent of this Element instance. (Inherited from Element) |
ParentCollection | Gets the InlineCollection that contains this Inline instance. (Inherited from Inline) |
Revision | Gets or sets the revision information for the inline. (Inherited from Inline) |
Inherited Methods
GetChildElements(System.Boolean) | Gets the child elements. (Inherited from Element) |
GetChildElements(System.Boolean, ElementType[]) | Gets the child elements filtered by ElementType. (Inherited from Element) |
GetParentElements() | Gets the parent elements. (Inherited from Element) |
GetParentElements(ElementType[]) | Gets the parent elements. (Inherited from Element) |