超链接到文档DocX dll C#中的位置

时间:2016-08-19 09:01:16

标签: c# asp.net ms-word docx novacode-docx

我目前正在使用来自asp.Net网站的Novacode DocX dll和C#生成Word文档,我尝试实现的是在文档中创建指向其中元素的超链接(单击一个段落和例如,转到第一页),到目前为止我所取得的成就是以这种方式创建指向文档外部的超链接:

Hyperlink lnk = document.AddHyperlink("Google", new Uri("http://www.google.com"));

// Create Paragraph and set the link
Paragraph par = document.InsertParagraph();
par.Append("Google");
par.AppendHyperlink(lnk);

在互联网上搜索了一段时间并玩超级类我无法找到实现此目的的方法,有人知道该怎么做吗?

非常感谢提前。

1 个答案:

答案 0 :(得分:0)

你必须使用相对链接,例如href =" #_ top"对于文档的顶部,并为文档中的其他位置添加书签。但我不确定docX是否处理书签。

相关问题