Nevron Open Vision Documentation
Hyperlink Inlines

Hyperlinks inline elements are similar to the anchor tag elements in HTML. They allow you to associate a URL to text, which when clicked in a browser navigates the browser to a different URL. Hyperlinks can also be used as bookmarks.

Creating Hyperlinks

Hyperlink inline elements are represented by instances of the NHyperlinkInline class. The following example shows how to create a hyperlink that points to www.nevron.com:

Creating Hyperlink Inlines
Copy Code
NSection section = new NSection();
NParagraph paragraph = new NParagraph();

NHyperlinkInline hyperlink = new NHyperlinkInline();
hyperlink.Hyperlink = new NUrlHyperlink("http://www.nevron.com", ENUrlHyperlinkTarget.SameWindowSameFrame);
hyperlink.Text = "Jump to www.nevron.com";
paragraph.Inlines.Add(hyperlink);

section.Blocks.Add(paragraph);

richTextView.Content.Sections.Clear();
richTextView.Content.Sections.Add(section);

The url hyperlink target values are described in the following table:

ENUrlHyperlinkTarget Description
NewWindow Opens the Url in a new browser window
SameWindowParentFrame Opens the Url in the same browser window, but in the parent frame
SameWindowSameFrame Opens the Url in the same browser window and frame
SameWindowTopFrame Opens the Url in the full body of the window
Creating Bookmarks 

Bookmarks in the NOV rich text editor are represented by the NBookmarkInline class. It has a property called Name, which can be referred to from hyperlinks or used by the user to position the control view on that bookmark. The following example shows how to create a bookmark inline:

Creating Bookmarks
Copy Code
NParagraph paragraph = new NParagraph();

NBookmarkInline bookmark = new NBookmarkInline();
bookmark.Name = "MyBookmark";
bookmark.Text = "This is a bookmark";
paragraph.Inlines.Add(bookmark);

section.Blocks.Add(paragraph);

richTextView.Content.Sections.Clear();
richTextView.Content.Sections.Add(section);

To create a hyperlink that points to the bookmark simply create a hyperlink inline and set its hyperlink property to new NBookmarkHyperlink referencing the name of the bookmark:

Creating Hyperlink Inline to a Bookmark
Copy Code
NHyperlinkInline hyperlink = new NHyperlinkInline();
hyperlink.Hyperlink = new NBookmarkHyperlink("MyBookmark");
hyperlink.Text = "Jump to MyBookmark";
paragraph.Inlines.Add(hyperlink);

To position the rich text view so that the bookmark is visible to the user you can use the Goto method:

Navigating to a Bookmark
Copy Code
richTextView.Content.Goto(ENTextDocumentPart.Bookmark, "MyBookmark", true);
See Also
Send Feedback