Ant*_*Tun 7 c# sharepoint openxml
我在添加到我的word文档的超链接时遇到了麻烦.我不知道怎么做.我想使用open xml在我的C#代码中的word文档中建立链接.是否只使用href或类似的不同解决方案?Open XML上有一个HyperLink类但是如何使用它?
Khu*_*hid 11
试试这个
using (WordprocessingDocument doc = WordprocessingDocument.Open("", true))
{
doc.MainDocumentPart.Document.Body.AppendChild(
new Paragraph(
new Hyperlink(new Run(new Text("Click here")))
{
Anchor = "Description",
DocLocation = "location",
}
)
);
doc.MainDocumentPart.Document.Save();
}
Run Code Online (Sandbox Code Playgroud)