如何检索演示文稿中 PowerPoint 幻灯片之间的链接
我正在寻找一种方法来读取单个 PowerPoint 演示文稿中幻灯片之间的链接。我需要打开一个 PowerPoint 文件并检索幻灯片之间的所有链接。
现在我正在使用 Aspose 但似乎他们没有任何内容可以读取幻灯片之间的链接。
我阅读了有关 PowerPoint 2007/2010 文件格式的更多内容,发现它只是一个 zip 存档。重命名后,您可以看到其中的所有 xml 数据。有谁知道其中的众多 xml 文件中的哪一个包含链接到哪张幻灯片以及哪张幻灯片的信息?
我需要用 C# 或 VB.NET 来完成。
I`m looking for a way to read a links between slides in single PowerPoint presentation. I need to open a PowerPoint file and retrieve all links slides have to each other.
Right now I`m using Aspose but it appears they do not have anything to read links between slides.
I've read some more about the PowerPoint 2007/2010 file format and found out that it`s just a zip archive. After renaming it you can see all the xml data inside it. Does anybody know which one of the many xml files inside it contains information what slide is linked and to what slide?
I need to do it in C# or VB.NET.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果没有必要的话,就没有必要在这里使用 OpenXML - 这可以通过对象模型来完成。以下是在 VBA 中完成的方法,它可以轻松移植到 C# 或 VB.NET。
不过,
slideTitle = InStrRev(h.SubAddress, ",")
并不是万无一失的。内部链接的模式是#,#,Slide Title
,因此您可能需要使用一些正则表达式来使其更好。There's no need to go to OpenXML here if you don't have to - this can be done with the Object Model. Here's how it is done in VBA, which can easily be ported to C# or VB.NET.
The
slideTitle = InStrRev(h.SubAddress, ",")
isn't fool-proof though. The pattern for internal links is#,#,Slide Title
, so you may have to make this better with like some RegEx.要在 C# 中完成此操作,这里有一个查找链接幻灯片的好方法:
请注意,超链接可在您关心的形状的所需 ActionSettings 中找到(在我的例子中,它是
shape.ActionSettings[PpMouseActivation.ppMouseClick]
中用于链接的子地址的格式类似于
SlideId,SlideIndex,SlideTitle
使用此方法通过一些小调整来获取其他部分(如果需要)应该相当简单。 。To accomplish this in C#, here is a good method to find the linked slide:
Note that the Hyperlink is found within the desired ActionSettings for the Shape you care about (in my case it was
shape.ActionSettings[PpMouseActivation.ppMouseClick]
.The sub-address for linking in PowerPoint is formatted like
SlideId,SlideIndex,SlideTitle
. It should be rather simple to obtain the other parts(if desired) with this method via some small tweaks.