Checking if PowerPoint placeholder is empty

31 views Asked by At

I'm using the python-pptx library maintained by scanny. I have manually inserted placeholders in the Powerpoint template (in the layout, not in the slide).

I am looking for a way to check if a placeholder is already in use. I want to be sure that a picture placeholder does not contain any elements before inserting an image into it.

How do I express the "placeholder is not in use" part of the following code snippet?

for placeHolder in slide.placholders:
    if placeHolder.name == "myplaceholder" and "placeholder is not in use":
        image = placeHolder.insert_picture("myimage.jpg")
0

There are 0 answers