如何使用docx.dll动态创建超链接,目前在下面尝试但不起作用
using (DocX document = DocX.Create(@"Test.docx"))
{
// Add a hyperlink to this document.
Hyperlink h = document.AddHyperlink
("Google", new Uri("http://www.google.com"));
// Add a new Paragraph to this document.
Paragraph p = document.InsertParagraph();
p.Append("My favourite search engine is ");
p.AppendHyperlink(h);
p.Append(", I think it's great.");
// Save all changes made to this document.
document.Save();
}
使用p.AppendHyperlink("www.google.com", "Google", HyperlinkType.WebLink);
怎么样?
此外,你可以从插入超链接到C#中的单词中获取引用。