本文介绍了DocX库添加超链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用这篇文章 [],但我无法理解如何向doc添加超链接。
I use this article C#: Create and Manipulate Word Documents Programmatically Using DocX[^], but i cannot understand how add hyperlinks to doc.
string fileName = @"DocXExample.docx";
// Create a document in memory:
var doc = DocX.Create(fileName);
// Insert a paragrpah:
doc.InsertParagraph("This is my first paragraph");
doc.AddHyperlink("URL", new Uri("http://www.google.com")); // this code not work
doc.Save();
// Open in Word:
Process.Start("WINWORD.EXE", fileName);
推荐答案
这篇关于DocX库添加超链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!