-
Notifications
You must be signed in to change notification settings - Fork 0
/
BookmarksAndHyperlinksActions.vb
34 lines (32 loc) · 1.38 KB
/
BookmarksAndHyperlinksActions.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
Imports DevExpress.XtraRichEdit
Imports DevExpress.XtraRichEdit.API.Native
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Text
Imports System.Threading.Tasks
Namespace DXRichEditControlAPISample.CodeExamples
Friend Class BookmarksAndHyperlinksActions
Private Shared Sub InsertBookmark(ByVal document As Document)
' #Region "#InsertBookmark"
document.LoadDocument("Documents//Grimm.docx", DocumentFormat.OpenXml)
document.BeginUpdate()
Dim pos As DocumentPosition = document.Range.Start
document.Bookmarks.Create(document.CreateRange(pos, 0), "Top")
'Insert the hyperlink anchored to the created bookmark:
Dim pos1 As DocumentPosition = document.CreatePosition((document.Range.End).ToInt() + 25)
document.Hyperlinks.Create(document.InsertText(pos1, "get to the top"))
document.Hyperlinks(0).Anchor = "Top"
document.EndUpdate()
' #End Region ' #InsertBookmark
End Sub
Private Shared Sub InsertHyperlink(ByVal document As Document)
' #Region "#InsertHyperlink"
Dim hPos As DocumentPosition = document.Range.Start
document.Hyperlinks.Create(document.InsertText(hPos, "Follow me!"))
document.Hyperlinks(0).NavigateUri = "https://www.devexpress.com/Products/NET/Controls/WinForms/Rich_Editor/"
document.Hyperlinks(0).ToolTip = "WinForms Rich Text Editor"
' #End Region ' #InsertHyperlink
End Sub
End Class
End Namespace