简体   繁体   English

在Powerpoint上是否有任何有关Python win32com操作的文档?

[英]Is there any document for the Python win32com operations on Powerpoint?

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(eg generate a thumbnail from a specified slide). 但我想做更多其他操作(例如,从指定的幻灯片生成缩略图)。 What methods can I use? 我可以使用什么方法? Is there any document illustrating all the functionalities? 是否有任何文件说明所有功能?

Not to discourage you, but my experience using COM from Python is that you won't find many examples. 并没有阻止您,但是我从Python使用COM的经验是,您不会找到很多示例。

I would be shocked (but happy to see) if anybody posted a big tutorial or reference using PowerPoint in Python. 如果有人在Python中使用PowerPoint发布大型教程或参考文献,我会感到震惊(但很高兴见到)。 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. 但是,如果您继续阅读该文章以及其他一些Python + COM代码,就会开始看到使用相同接口将VB和C#代码转换为Python代码的模式。

Once you understand that, your best source of information is probably the PowerPoint API reference on MSDN. 一旦您了解了这一点,您最好的信息来源可能就是MSDN上的PowerPoint API参考

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: 通过查看耶利米所指的样本,假设您要导出幻灯片#42,看起来您应该从那里开始然后执行以下操作:

Slide = Presentation.Slides(42)
Slide.Export FileName, "PNG", 1024, 768

Substitute the full path\\filename.ext to the file you want to export to for Filename; 将完整路径\\ filename.ext替换为您要导出到的文件的文件名; string. 串。 Use PNG, JPG, GIF, WMF, EMF, TIF (not always a good idea from PowerPoint), etc; 使用PNG,JPG,GIF,WMF,EMF,TIF(在PowerPoint中并非总是一个好主意)等; 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) VBLong(带符号的32位(4字节)数字,范围从-2,147,483,648到2,147,483,647)

I've petted pythons but never coded in them; 我宠爱了python,但从未对其进行编码; this is my best guess as to syntax. 这是我对语法的最佳猜测。 Shouldn't be too much of a stretch to fix any errors. 应该不会花费太多时间来修复任何错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM