0

I am playing around with using win32com to create power points programmatically. I have a issue when snooping around in the slide master.

Open a power point, go to

Home -> Editing -> Select -> Selection Pane

Then do

View -> Slide Master

I deleted all the contents of layout 1 and inserted a picture placeholder as shown below

enter image description here

import win32com.client
pp = win32com.client.Dispatch("PowerPoint.Application")
pres = pp.Presentations.Open("<your pptx file name>.pptx")
design = pres.Designs
design = pres.Designs(1)
master = design.SlideMaster
layouts = master.CustomLayouts
>>> layouts(1).shapes(1).Type
14 
>>> layouts(1).shapes(1).Name
'Picture Placeholder 7

My issue is that the Type enumeration, which I reference here, 14 is for ppPlaceholderHeader. Why is it not ppPlaceholderPicture? I.e. a Type of 18.

Perhaps I am navigating incorrectly and looking at wrong objects?

braX
  • 11,506
  • 5
  • 20
  • 33
Melendowski
  • 404
  • 4
  • 16

1 Answers1

1

ALL placeholders are Type 14 objects. If you want to know the type of placeholder, use:

.PlaceholderFormat.Type
Steve Rindsberg
  • 14,442
  • 1
  • 29
  • 34
  • Ah! My man. Thank you very much. I'm still learning the object models. – Melendowski Oct 14 '19 at 16:29
  • And for the sake of completeness, .PlaceholderFormat.ContainedType will give you the type of any content the placeholder contains (ie, it'll return 3 for a content placeholder that has a Chart) – Steve Rindsberg Oct 16 '19 at 15:27