Free Support Forum - aspose.com

Working with PlaceHolders

I’m just getting started with this component so I’m trying things I see in the demo code and I can’t seem to get things working :(. In PowerPoint I created my slide that I want to use as the template. I’ve created it as the master slide and as a normal slide and it doesn’t seem to work regardless of how I try to create it. What I need to do is loop through the placeholders (I am making the assumption that a textbox object on a PPT slide is a placeholder if it isn’t let me know) and populate the various placeholders with data coming from a datareader.

Attached are ai.ppt and ai2.ppt showing the two PPT files I’ve created. I really need to get this working ASAP as we have a demo coming up tomorrow and I need to be able to show this feature off!

FWIW I’ve tried looping through the placeholders on all of the slides with the following code:

For x = 0 To slides.Count - 1
Dim y As Integer = 0

pholders = slides(x).Placeholders
Label1.Text = "
slide " & x.ToString & " -> " & pholders.Count
For y = 0 To pholders.Count - 1
If TypeOf pholders(y) Is TextHolder Then
Label1.Text &= "
PHolder " & y.ToString & " is textholder"
Else
Label1.Text &= "
Pholder " & y.ToString & " type is " & pholders(y).PlaceholderType.ToString
End If
Next
Next

Regardless if I use ai.ppt or ai2.ppt the results are 2 placeholders are found. The first one is a CenteredTitle1 and the second is Body.

Since I couldn’t attach two files to my post here’s the second file.

Thanks in advance for your assistance!

Dear Zack,

Placeholder is a abstract type. If you have 2 Placeholders it means they were not recognized as correct shapes.
Text can be changed in TextHolder only.

In your presentation you should iterate Shapes.

Thanks for the reply, by switching over to shapes I was able to get things working properly.