【问题标题】:create Hyperlink with docx.dll?用 docx.dll 创建超链接?
【发布时间】:2016-03-08 20:34:12
【问题描述】:

如何动态创建带有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();
}

【问题讨论】:

    标签: c# ms-word openxml docx


    【解决方案1】:

    使用p.AppendHyperlink("www.google.com", "Google", HyperlinkType.WebLink); 怎么样?
    另外,您可以参考Insert Hyperlink to Word in C#

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-10-28
      • 2012-12-25
      • 2018-03-09
      • 2019-06-12
      • 1970-01-01
      • 2012-11-07
      相关资源
      最近更新 更多