PowerPoint Slide Replace PlaceHolder with Object (Image)

T

Techno_Dex

I am trying to figure out in code how to replace a Shape of a particular
PlaceHolderType with an actual object, but am not seeing how right off. I
have added a Slide of Type ppSlideLayout.ppLayoutTextAndClipart, then I loop
through the Shapes on the Slide and extract each Type and do processing
accordingly. My problem is when I get a Shape of type ppPlaceholderBitmap
(or similar) I'm not sure how to add/set an image for this placeholder. I
have figured out how to add an Image to the Slide, but this does not remove
the ShapeHolder that was added by default. What am I missing.

TIA.
 
S

Steve Rindsberg

I am trying to figure out in code how to replace a Shape of a particular
PlaceHolderType with an actual object, but am not seeing how right off. I
have added a Slide of Type ppSlideLayout.ppLayoutTextAndClipart, then I loop
through the Shapes on the Slide and extract each Type and do processing
accordingly. My problem is when I get a Shape of type ppPlaceholderBitmap
(or similar) I'm not sure how to add/set an image for this placeholder. I
have figured out how to add an Image to the Slide, but this does not remove
the ShapeHolder that was added by default. What am I missing.

Do you actually need to "fill" the placeholder with a bitmap or is it enough to
add a new bitmap shape and delete the placeholder?
 
M

msnews.microsoft.com

What is the correct way? I'm assuming that MS created the object model so
that you could add Slides of known type then get each shape and perform
processing on it, but by all means if this is not correct, please fill me
in.
 
S

Steve Rindsberg

What is the correct way? I'm assuming that MS created the object model so
that you could add Slides of known type then get each shape and perform
processing on it, but by all means if this is not correct, please fill me
in.

Personally, I'd prefer to delete the placeholder and insert a bitmap file
directly (via .Shapes.Add ...)

Unless you need the master to control the size/position of the image, I don't
see any real benefit to keeping it a placeholder.
 
T

Techno_Dex

What you are saying makes since. I'm just not sure if this is the way MS
intended for the object model to be used. I have a feeling this is exactly
what they are doing behind the scenes when a user double clicks on a
placeholder in a slide. It's always seams when dealing with the MS Office
Object Model that everything is always bass akwards. I have just been
adding slides using the PpSlideLayout enums to get the desired slide type
and then parsing the shapes from that slide type. I take it your
recommending to just add a ppLayoutBlank slide then add the desired Shapes
(Rectangles, Pictures, Charts, etc..) on my own then place them where I
want??? I guess my next question is, what is the point of having different
PpSlideLayouts (i.e. ppLayoutChartAndText, ppLayoutTextAndClipart, etc...)
if we can't really use them ??? Thanks by the way for you input so far.
 
S

Steve Rindsberg

What you are saying makes since. I'm just not sure if this is the way MS
intended for the object model to be used. I have a feeling this is exactly
what they are doing behind the scenes when a user double clicks on a
placeholder in a slide. It's always seams when dealing with the MS Office
Object Model that everything is always bass akwards. I have just been
adding slides using the PpSlideLayout enums to get the desired slide type
and then parsing the shapes from that slide type. I take it your
recommending to just add a ppLayoutBlank slide then add the desired Shapes
(Rectangles, Pictures, Charts, etc..) on my own then place them where I
want???

For the kinds of things I do, I find that it's USUALLY easier to start with a
slide of the layout type that most closely matches what I want to end up with,
especially if it's to be a text slide. Text in placeholders behaves
differently from text in text boxes. If the user's expecting regular "Click
here" text, you'll want to stay with placeholders.
I guess my next question is, what is the point of having different
PpSlideLayouts (i.e. ppLayoutChartAndText, ppLayoutTextAndClipart, etc...)
if we can't really use them ??? Thanks by the way for you input so far.

You can certainly use them! But not all of the internal methods are exposed,
so in some cases it's not always possible to duplicate in code what a user can
do manually. I think your "bitmap in content placeholder" problem is one
example of this. Or maybe I'm just missing something obvious and there IS a
method to add the bitmap to the placeholder. :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top