有没有关于Powerpoint上的Python win32com操作的文档?
我获得了一些有关如何打开演示文稿并访问幻灯片和形状的示例。但我想做更多其他操作(例如从指定的幻灯片生成缩略图)。我可以使用什么方法?有没有说明所有功能的文档?
I have gat some samples about how to open a presentation and access the slides and shapes. But I want to do some more other operations(e.g. generate a thumbnail from a specified slide). What methods can I use? Is there any document illustrating all the functionalities?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
并不是要阻止您,但根据我在 Python 中使用 COM 的经验,您不会找到很多示例。
如果有人发布了在 Python 中使用 PowerPoint 的大型教程或参考资料,我会感到震惊(但很高兴看到)。您可能会找到的最好的文章(您可能已经找到了)是这篇文章
但是,如果您继续阅读该文章以及其他一些 Python+COM 代码,您就会开始看到 VB 和 C# 代码如何使用相同的接口转换为 Python 代码的模式。
了解这一点后,最好的信息来源可能是 MSDN 上的 PowerPoint API 参考。
Not to discourage you, but my experience using COM from Python is that you won't find many examples.
I would be shocked (but happy to see) if anybody posted a big tutorial or reference using PowerPoint in Python. Probably the best you'll find, which you've probably already found, is this article
However, if you follow along through that article and some of the other Python+COM code around, you start to see the patterns of how VB and C# code converts to Python code using the same interfaces.
Once you understand that, your best source of information is probably the PowerPoint API reference on MSDN.
从查看 Jeremiah 指出的示例来看,您似乎应该从那里开始,然后执行类似的操作,假设您想要导出幻灯片 #42:
将完整路径\filename.ext 替换为您要导出到的文件名;细绳。
使用 PNG、JPG、GIF、WMF、EMF、TIF(PowerPoint 并不总是一个好主意)等;细绳
接下来的两个数字是导出图像的宽度和高度(以像素为单位); 值范围从 -2,147,483,648 到 2,147,483,647)
VBLong(有符号的 32 位(4 字节)数字, 这是我对语法的最佳猜测。修复任何错误不应该太费力。
From looking at the samples Jeremiah pointed to, it looks like you'd start there then do something like this, assuming you wanted to export slide #42:
Substitute the full path\filename.ext to the file you want to export to for Filename; string.
Use PNG, JPG, GIF, WMF, EMF, TIF (not always a good idea from PowerPoint), etc; string
The next two numbers are the width and height (in pixels) at which to export the image; VBLong (signed 32-bit (4-byte) numbers ranging in value from -2,147,483,648 to 2,147,483,647)
I've petted pythons but never coded in them; this is my best guess as to syntax. Shouldn't be too much of a stretch to fix any errors.