Linking text to a Bookmark


I have created a Bookmark using StartBookmark() and EndBookmark() methods. Folllowing is the code which i have used in C#:

Document Doc = new Document();

DocumentBuilder DocBuilder = new DocumentBuilder(Doc);




Bookmark Hello got created.

At some place in the code i need to link someother text with hello Bookmark. How can i do this?

If i again use the above code it will create new Bookmark. What should i do?


I am not sure I understand correctly what you mean by 'linking' text to bookmark, but if you want to change the text inside bookmark you can do it by using code like this:

doc.Range.Bookmarks["SomeBookmark"].Text = "New text";


If I have created a Bookmark at the top of the document and want to link it to some text at the end of the document. How can i do that?


Here is an example:

Document doc = new Document();

DocumentBuilder builder = new DocumentBuilder(doc);




builder.Writeln("Some text");

builder.Writeln("Some text");

builder.Writeln("Some text");

// Specify font formatting for the hyperlink.

builder.Font.Color = System.Drawing.Color.Blue;

builder.Font.Underline = Underline.Single;

// Insert the hyperlink.

builder.InsertHyperlink("Link text", "Hello", true);

// Clear hyperlink formatting.


doc.Save(Application.StartupPath + @"\testLinkBookmark.doc");


Thank you Miklovan.