Free Support Forum - aspose.com

Link to bookmark in another document

Hi,

How does one insert a link to a bookmark in another docx file?

Thanks

Hi Brad,

Thanks for your inquiry.

You need to use the hyperlink field to do this. You can use the InsertHyperlink method of the DocumentBuilder class. To link to a specific bookmark in a document you need to insert the path the document and follow with the name of the bookmark with a preceeding hash character. For example:

builder.InsertHyperlink("Link to External Document", "C:\\Document.doc#Bookmark1", false);

In this case it will link to a document found at the specified path and link directly to the bookmark named "Bookmark1".

If you have any further queries, please feel free to ask.

Thanks,