Free Support Forum -

How to Dynamically pass the Bookmark Name and Tip text dynamically in InsertHyperlink

In the Inserts a hyperlink referencing local bookmark example, we have hard coded the Bookmark name as "Bookmark1" and Tip text as "Hyperlink Tip" as below.

builder.Write("Bookmarked text.");

// Insert hyperlink.
// Switch \o is used to provide hyperlink tip text.
builder.InsertHyperlink("Hyperlink Text", @"Bookmark1"" \o ""Hyperlink Tip", true);

In my application, I need to pass the bookmark name and tip text dynamically. Then what is the string format for the second perameter in the InsertHyperlink function? Please find the attachment for code and error screen shots

builder.InsertHyperlink(HyperlinkName, @"Bookmark1"" \o ""Hyperlink Tip", true);

If I pass the second peram as below,

builder.InsertHyperlink(HyperlinkName, bookmarkName + @" \o " + bookmarkTip, true);

then the tip text is like full filepath#Country o Sales Data instead of Sales Data where Country is the bookmarkName.


Thanks for your request. It seems there is some problem with double quotes. Please try using the code like the following:

Dim bookmarkName As String = "MyBookmark"

Dim bookmarkTip As String = "This is tooltip for my hyperlink"

Dim doc As New Document()

Dim builder As New DocumentBuilder(doc)

' Insert bookmark.



' Insert a hyperlink to bookmark on the next page.


' Insert Hyperlink.

builder.InsertHyperlink("Link to bookmark", "" & bookmarkName & """" & "\o " & """" & bookmarkTip & "", True)

' Save output.


Best regards,