Generate Single PowerPoint from two powerpoints using pywin32(python)

Paul McNett paul at mcnettware.com
Wed Jun 18 16:38:18 EDT 2014


On 6/16/14, 11:20 PM, Jaydeep Patil wrote:
> I have two powerpoints, which consists of images in each slide.
> I need to read each powerpoint, copy images from both powerpoint & paste these images into output powerpoint side by side.
>
> How should i do thism using python?
> The repoisition of shapes seems to be difficult.

This seems like the wrong forum to ask this. Whatever the right 
Powerpoint calls are to accomplish this, it has nothing to do with 
Python. Well, you are making the calls via Python but the content of the 
calls aren't python.

Back in the old days (it's been over a decade since I've worked with 
Microsoft Office using COM automation) when I needed to figure out how 
to programatically manipulate a Powerpoint slide or Excel spreadsheet, 
my general flow was:

1) turn on the macro recorder in Office.
2) do the operation that needs doing, using the Office UI.
3) save the macro.
4) set up the situation again, and this time play back the macro to make 
sure it works.
5) convert the macro code into whatever is needed in the client 
programming language (usually just wrapping the actual macro lines of 
code into strings passed using a pywin32 function)
6) test running the situation with the calling client programming language.

Frankly, I'm not sure COM automation is the current way to interact with 
Microsoft stuff, but surely by querying other forums (Microsoft Office 
automation forums should exist, I'd think) on how to do #1-3 above would 
get you halfway. Then you could ask here about how to use pywin32 (or 
whatever) to communicate with Powerpoint to do the work.

Does that make sense?
Paul





More information about the Python-list mailing list