PowerPoint 以编程方式在加载项中打开/播放媒体对象

发布于 2024-09-24 17:19:50 字数 158 浏览 1 评论 0原文

我正在开发一个 VSTO PowerPoint 2010 加载项,它将允许用户使用 Windows 媒体播放器控件在 Windows 窗体中播放媒体对象(视频或音频)。

我可以通过什么方式提取嵌入的媒体对象并将其播放给用户?

我可以访问对象名称,这足以访问嵌入的对象吗?

I am working on a VSTO PowerPoint 2010 add-in which will allow the user to playback a media object (video or audio) in a windows form using windows media player control.

In which way can I extract the embedded media object an play it back to the user?

I have access to the objects name, will that be enough to get to the embedded object?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

み青杉依旧 2024-10-01 17:19:50

有点是又不是。

  • “不”。通过VBA和VSTO,答案是否定的,或者至少我以前从未见过它并且不知道。我以前看过这个,但发现它不可能。

  • “有点是”。 2007/2010 年的任何嵌入媒体都可以通过 Open XML 提取。这就是“有点”的用处——只要您知道要提取什么,就可以提取它。听起来很容易,但事实并非如此。当您插入视频或音频片段时,它会嵌入到形状中。该形状被赋予名称[1],这是音频/视频文件的文件名。因此,如果我插入Win7附带的示例视频,则保存该视频的形状名称是“wildlife.wmv”。知道如何操作的最终用户(客户端中的选择窗格)可以轻松地对其进行重命名,在这种情况下,仅凭名称就无法找到它。

    但如果尚未重命名,您将在 Open XML 中打开 .pptx 的内存副本,在 /ppt/slides/ 文件夹中的每张幻灯片中搜索名称,一旦找到,请使用它是在 /ppt/media 文件夹中查找其名称的关系 ID。然后你可以把它拉出来,保存到磁盘,播放等等。

1 但是,PowerPoint 会根据内部命名约定重命名该文件。我的“wildlife.wmv”在包内被重命名为“media1.wmv”。后续媒体项目将命名为 media2.wmv、media1.mpg 等。

Kinda yes and no.

  • The "No". Through VBA and VSTO, the answer is no or at least I've never seen it done before and have no idea. I've looked at this before and didn't find it to be possible.

  • The "Kinda Yes". Any embedded media in 2007/2010 can be extracted through Open XML. Here's where the "kinda" comes in - you can extract it so long as you know what you're extracting. Sounds easy enough, but it's not. When you insert a video or audio piece, it gets embedded into a shape. That shape is given a name[1], which is the file name of the audio/video file. So if I insert the sample video that comes with Win7, my shape name that holds the video is "wildlife.wmv". It can easily be renamed by an end user who knows how to do so (the Selection Pane in the client) and in that case, it would be impossible to find based on just having the name.

    But if it hasn't been renamed, you would open an in-memory copy of your .pptx in Open XML, search on the name in each of the slides in the /ppt/slides/ folder and once found, use it's relationship Id to locate it's name in the /ppt/media folder. Then you can pull it out, save it to disk, play it, etc.

1 PowerPoint, however, renames the file based on an internal naming convention. My "wildlife.wmv" is renamed "media1.wmv" inside the package. Subsequent media items would be named media2.wmv, media1.mpg, etc.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文