Hyperlinks
Hyperlinks are Fields elements, which point to a specific location. The location can be a web page or a bookmark inside the document.
Hyperlink Properties
The Hyperlink field exposes the following properties:
Uri: Specifies the URI of the hyperlink.
IsAnchor: Specifies whether the hyperlink points to a bookmark. The value is true if the hyperlink is pointing to a bookmark inside the document. Default value is false.
ToolTip: Specifies the hyperlink tooltip.
Inserting a Hyperlink
The suggested way to insert hyperlink is by using RadFlowDocumentEditor. The InsertHyperlink() method accepts the hyperlink text, URI, IsAnchor value and tooltip as parameters. The code in Example 1 shows how to insert a hyperlink to www.telerik.com:
Example 1: Insert a hyperlink
editor.InsertHyperlink("telerik", "http://www.telerik.com", false, "Telerik site");
The result looks like shown in Figure 1.
Figure 1: Hyperlink inserted in a document
The InsertHyperlink() method also automatically applies the Hyperlink style to the result fragment of the inserted field. More information about styles is available in the Styles article.
Hyperlinks can also point to a Bookmark inside the document. Example 2 how to create a document containing a bookmark and a hyperlink pointing to that bookmark.
Example 2: Insert a hyperlink pointing to a bookmark
RadFlowDocumentEditor editor = new RadFlowDocumentEditor(new RadFlowDocument());
// Insert bookmark.
editor.InsertBookmark("DocumentStart");
editor.InsertLine("Hello word!");
// Insert hyperlink pointing to the bookmark.
editor.InsertHyperlink("Go to start", "DocumentStart", true, "Document start");
The result of the above snippet is illustrated in Figure 2.