Search code examples
c#.netnovacode-docx

C# DocX : add internal link


In the DocX library available at : https://github.com/WordDocX/DocX

It is possible to add some hyperlink but i haven't found a way to add internal link.

Does anyone know how to add a link to specific paragraph or to a bookmark ?


Solution

  • The way I've found is:

    synthesisDocument.AddHyperlink("Link",new Uri("file:///path/to/doc/file.doc#MY_BOOKMARK")); synthesisDocument.Paragraphs[0].InsertHyperl‌​ink(h)

    That way resolve your problem, but only in doc format, when you export to PDF it doesn't work. I hope it helps