We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Wrong Placeholder Types or Missing Placeholders?

Hi,

please explain how placeholders work in ppt format.
Simple example:
create a very simple ppt file with Powerpoint2007 and save it as ppt/97 a.ppt
a.ppt only has one slide which contains title/subtitle/dateTime/footer/slideNr
i would expect that there would be 5 placeholders within the slide, but there only two, which have type 0

final com.aspose.slides.Presentation presentationA = new com.aspose.slides.Presentation(new FileInputStream(“d:/a.ppt”));
final Slide slideA = presentationA.getSlideByPosition(1);
final PlaceholderCollection placeholders = slideA.getPlaceholders();
for(int i = 0; i < placeholders.getCount(); i++) {
final Placeholder ph = placeholders.get_Item(i);
System.out.println(“ph:” + ph);
System.out.println(“ph-type:” + ph.getPlaceholderType());
System.out.println(“ph-text:” + ((TextHolder)ph).getText());
}

ph:com.aspose.slides.TextHolder@97d01f
ph-type:0
ph-text:Folie A
ph:com.aspose.slides.TextHolder@e0a386
ph-type:0
ph-text:subtitleA

is this a bug and what should be the desired output?

best regards,
D.Croe

Hi D.Core,

I have worked with the sample code shared by you and have worked with the presentation file shared by you. Actually, your presentation has only two placeholders in it. The shapes in footer area of slide are normal Rectangle but not placeholders. Please try using the following sample code to serve the purpose.

public static void testPlaceholder() throws Exception
{
final com.aspose.slides.Presentation presentationA = new com.aspose.slides.Presentation(new FileInputStream(“d:/Aspose Data/a.ppt”));
final Slide slideA = presentationA.getSlideByPosition(1);
final PlaceholderCollection placeholders = slideA.getPlaceholders();

System.out.println("Shapes Count: " + slideA.getShapes().getCount());

for(int i = 0; i < slideA.getShapes().getCount(); i++)
{
Shape shape=slideA.getShapes().get_Item(i);

if(shape.getPlaceholder()!=null)
{
final Placeholder ph = placeholders.get_Item(i);
System.out.println(“ph:” + ph);
System.out.println(“ph-type:” + ph.getPlaceholderType());
System.out.println(“ph-text:” + ((TextHolder)ph).getText());
}
else if(shape instanceof Rectangle)
{
Rectangle ashp=(Rectangle)shape;
System.out.println(“ashp:” + ashp);
System.out.println(“ashp-name:” + shape.getName());
}

}
}

Aspose.Slides exhibits the right behavior and it is not an issue.

Many Thanks,

Hi Mudassir,

a) why are the footer, dateTime and slideNr only shapes and not placeholders?

in pptx and powerpoint97 those "fields" are placeholders:

saved in pptx format following placeholders will be found:

ph-type:2:CenteredTitle

ph-type:3:Subtitle

ph-type:4:DateAndTime

ph-type:5:SlideNumber

ph-type:6:Footer

i think this is a bug or i didn't understand how it works. please help me to understand the concept or confirm this as a bug!

b) how does powerpoint identify them if i toogle visibility in PowerPoint, if those fields are not ment to be placeholders!?

c) please confirm the bug, that the placeholder type of title and subtitle are wrong

best regards,

D.Croe

Hi D.Croe,


I have discussed the issues with our development team. I have created an issue with ID SLIDESJAVA-34390 in our issue tracking system to investigate the whether it is normal behavior that footer shapes are Rectangle shapes rather than placeholder.

A separate issue with ID SLIDESJAVA-34391 has been created in our issue tracking system to investigate the issue of wrong placeholder type returned for title and sub-title placeholders.

This thread has been linked with the issue so that you may be automatically notified once the issue will be resolved.

We are sorry for your inconvenience,

The issues you have found earlier (filed as SLIDESJAVA-34390) have been fixed in this update.