Very simple test is not working

It cannot find any placeholders.

for (int i = 0; i < slide.Placeholders.Count; i++)
.....

Always returns 0... it never gets into the loop. What wrong?

The powerpoint file is attached.

This is the code I have, which for the most part came from the help docs.

When I flush the file out I get the template as it is, with out any changes so I know it is reading the correct file.

It does the same thing if I read it form the file system.

The example seems simple enough put it is not working.

/////////////////////////////////////

Library.File file = new Library.File("406cfd37-8237-42d9-8dd4-11a4d34921f3");
byte[] data = Library.File.GetContentDataByFile(file);MemoryStream ms = new MemoryStream(data, 0, data.Length);
Stream mystream = ms;
Presentation pres = new Presentation(mystream);

//License lic = new License();
//lic.SetLicense("Aspose.Slides.Lic");

Slide slide = pres.Slides[0];
TextHolder th = null;

for (int i = 0; i < slide.Placeholders.Count; i++)
{
th = (TextHolder)slide.Placeholders[i];
if (th.Text.ToLower().Equals("test.author"))
{
th.Paragraphs[0].Portions[0].Text = "My Test Title";
}
}
return pres;

////////////////////////////////////////////////////////////////////////////////

Well I think I know what is going on... not sure of a solution yet....

The ppt file in the sample above was saved from PowerPoint 2007 as a compatible file.

Continous testing gives me this.....

If I do a regular .pptx file with the Shapes example it works fine.

If I do a regular .ppt file with the placeholder example it works fine.

If I do a 2007 saved as 2003 compatible neither solution works correctly.

Any thoughts on this?

Hi William,

Thanks for your interest in Aspose.Slides.

Unfortunately, while accessing a placeholder in your presentation, I am unable to do so. So, it seems to be an issue with our product. An issue with issue ID 14388 has been created on our Issue Tracking System to fix the problem. This thread has been associated with this issue, so that you can be automatically notified as soon as this issue is resolved

We are sorry for inconvenience.

Hi William,

Thanks for your interest in Aspose.Slides.

We have further investigated the problem and we have found that a PPT presentation when created in PowerPoint 2007 doesn’t have placeholders inside it. You should please iterate through the shapes on the slide to get rectangle with text. Please use the following code snippet.

//Loading presentation
Presentation pres = new Presentation("D://ppt//Presentation1.ppt");

//Loading first slide
Slide slide = pres.Slides[0];

//Iterating through all shapes
for (int i = 0; i < slide.Shapes.Count; i++)
{
    if (slide.Shapes[i] is Aspose.Slides.Rectangle)
    {
        //Creating a rectangle object
        Aspose.Slides.Rectangle rec = (Aspose.Slides.Rectangle)slide.Shapes[i];

        //comapring text in text frame
        if (rec.TextFrame.Text.ToLower().Equals("test.author"))
        {
            //Setting new text in text frame
            rec.TextFrame.Paragraphs[0].Portions[0].Text = "Hello World";
        }
    }
}

pres.Write("d://ppt//Presentation1.ppt");

Thanks and Regards,