从 XPS 文档中检索超链接/书签列表?
我有一个 .docx 文件,其中包含一堆书签和超链接。我可以在文档查看器中很好地浏览这些内容。我想要的是是否可以生成文件中包含的所有超链接的列表。从那里,我可以在文档查看器上创建一个 TreeView 并按名称(使用列表)而不是静态页码调用链接。
这可能吗?如果是这样,怎么办?
或者是否有一个[免费]实用程序可以生成一个包含所有超链接及其引用页码或 Uris 的 XML 文件?
I have a .docx file with a bunch of bookmarks and hyperlinks. I can navigate through these in documentviewer just fine. What I would like is if it was possible to generate a list of all of the hyperlinks contained in the file. From there, I can create a TreeView on the documentviewer and call the links by name (using the list) instead of static page numbers.
Is this possible? If so, how?
Or is there a [free] utility that could generate an XML file with all of the hyperlinks and their referenced page numbers or Uris?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我在发布问题后不久就发现了这一点,但我认为我应该将其发布在这里,因为我在其他地方收到了有关此问题的消息。
XPS 文档本质上是 zip 文件。打开并解压它。找到文档结构的方法,您将看到一个易于解析的 XML 文件。从那里,您可以从目录中获取有关超链接的所有信息。然后,您只需在 WPF 中用 C# 设置请求 URI 处理程序即可。
I figured this out shortly after posting the question, but thought I should post it here because I received a message elsewhere about this.
XPS documents are essentially zip files. Open and extract it. Find your way to docstructure and you'll see an XML file which is easy to parse. From there, you can get all the information you want about the hyperlinks from the table of contents. Then you just set the request URI handlers in C# in WPF.