Word控件Spire.Doc 【超链接】教程(3):在C#中查找word文档中的超链接

下载并安装 Spire.Doc for .NET,然后通过以下路径将 Spire.Doc.dll 作为引用添加到下载的 Bin 文件夹中:“..Spire.DocBinNET4.0Spire.Doc.dll”。下面详细介绍如何在C#中查找超链接。

首先查看包含很多超链接的word文档:

在word文档中查找超链接

请查看如何在word文档中查找所有超链接的代码:

using Spire.Doc;using Spire.Doc.Documents;using Spire.Doc.Fields;using System.Collections.Generic;using System.Drawing;namespace FindHyperlink{class Program{static void Main(string[] args){Document doc = new Document();doc.LoadFromFile("Spire.docx");List hyperlinks = new List();foreach (Section section in doc.Sections){foreach (DocumentObject sec in section.Body.ChildObjects){if (sec.DocumentObjectType == DocumentObjectType.Paragraph){foreach (DocumentObject para in (sec as Paragraph).ChildObjects){if (para.DocumentObjectType == DocumentObjectType.Field){Field field = para as Field;if (field.Type == FieldType.FieldHyperlink){hyperlinks.Add(field);}}}}}}}

查找超链接的有效截图:

在word文档中查找超链接

以上便是如何在C#中旋转word文档上的形状,如果您有其他问题也可以继续浏览本系列文章,获取相关教程,你还可以给我留言或者加入我们的官方技术交流群。


欢迎下载|体验更多E-iceblue产品

获取更多信息请咨询在线客服  


标签:

声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!

上一篇 2022年10月11日 上午11:28
下一篇 2022年10月11日

相关推荐

发表回复

登录后才能评论