'' but unlike that sample uses hyperlinks collections
'' rather than HYPERLINK fields.
PublicClass Hyperlinks
Function CreateDocx()As GcWordDocument
Dim doc =New GcWordDocument()
Dim pars = doc.Body.Paragraphs
'' 0. Paragraph with an external hyperlink:
Dim p = pars.Add(
"It is easy to add hyperlinks to document content via Range.Hyperlinks collection. "+
"Following is a hyperlink to a web address. ")
'' There are different Hyperlinks.Add() overloads that allow to specify
'' different hyperlink options such as screen tips etc
Dim hl0 = p.GetRange().Hyperlinks.Add(New Uri("http://www.google.com"),Nothing,"Click to go to www.google.com.")
'' 1. Paragraph with an external hyperlink with its own style:
p = pars.Add("Next is another hyperlink, this time with its own style and a custom tooltip. ")
Dim hl1 = p.GetRange().Hyperlinks.Add(New Uri("https://www.grapecity.com/en/"),Nothing,"Click to go to www.grapecity.com.","Click to open GrapeCity web page")
'' 2. Link to a bookmark within the document:
'' We add bookmarks at the top and bottom of the document,
'' and set up links to jump between them.
Dim bmkTop ="BookmarkTop"
Dim bmkBot ="BookmarkEnd"
p = pars.Add(
"Hyperlinks can also point to locations within the document. "+
"We add some filler paragraphs below, followed by a paragraph "+
$"with a bookmark named '{bmkBot}' attached to it. "+
"The next hyperlink jumps to that bookmark. ")
'' Attach a bookmark to this paragraph so we can jump back here:
p.GetRange().Bookmarks.Add(bmkTop)
'' A hyperlink to a bookmark
Dim hl2 = p.GetRange().Hyperlinks.Add($"{bmkBot}",$"Click to jump to {bmkBot} at the end of the document.",$"Jumo to {bmkBot}")