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

Free Support Forum - aspose.com

Template access question


I am having trouble adding text to a slide. I am using a template.pot file as temeplate

Here is the code i am using

Presentation presentation = new Presentation(new FileInputStream(template.pot));
Slide slide = presentation.getSlideByPosition(this.presentation.getSlides().size()-1);
TextHolder textHolder = (TextHolder)slide.getPlaceholders().get(0);

I am getting an exception: java.lang.ClassCastException: com.aspose.slides.Placeholder

I want to get access to the placeholders to set the text, add tables etc.

Please help thanks in advance

Dear gtzotchev,

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for considering Aspose.Slides for JAVA.

Placeholder is a generic object, it could hold text, images etc. Texholder is a type of placeholder which holds text. It means, you need to add at least one character in the placeholders to successfully cast them into textholders later.

As an example, I have added a single space inside all the placeholders of your template file and then run your code without any exception. The modified template file is attached.