Free Support Forum - aspose.com

Facing a problem in cloning more than 15 slides in a presentation

hi!!!!

if i clone more than 15 slides in a presentation, the slides are created in the ppt but we cannot preview the slides.

guidance needed as early as u can..

We are using Microsoft Powerpoint 2000.

The error thrown is " Powerpoint found an error that it can't correct. Pls save presentation, quit and restart Powerpoint".

Thank u

regards.

I have created small test program and cloned more than 100 slides.

After that opened presentation in PowerPoint 2000 and XP without any problems.



Could you please show how you clone slides.

hi!!!

We call this function to clonethe slides

private Slide cloneTheSlide(Slide slide, int slideIndex) throws Exception
{
Slide cloneSlide = null;
try
{
cloneSlide = pres.cloneSlide(slide, slideIndex);
}
catch (Exception e)
{
System.out.println(" error"+e);
throw e;
}
return cloneSlide;
}

where index is incremented.

After cloning the slides we replace the existing paragraph by adding new paragraph by cloning .

is that any possibility of tht giving a problem??

Thank U

Regards

I reprodiced this problem with MS PowerPoint 2000. In my case it’s 45 slides (probably it depends on slide content).

But I don’t know why it happens yet.



As a quick solution use cloneSlide with 4 parameters:



pres.cloneSlide(slide, slideIndex, pres, new TreeMap());

In our case, we need to generate slides that depends on the data... that could even exceed 100.

with the previous solution only 40-45 slides are possible.

pls suggest some other alternative so that we can generate ppt error free.

Thank You

Regards

With this solution I created presentation which contains 500 slides and don’t have any problems.



Could you send me your template presentation for tests and example how you change text.

Do you have any tables on cloned slide?

Hi!!

As i have mentioned that we need more than 100 slides to be generated with each slide containing more than 1500 characters.

I add the paragraphs in the textholder as ter the data in this way

Paragraphs paras = textholder.getParagraphs();

paras.add(index, paragraph1);

and setting the text as follows

paras.get(indexItem).getPortions().get(0).setText("description");

this paragraph1 is declared and initialized from the base powerpoint file paragraph.

Thank U

Regards

Can I get your source template presentation?



What you mean “initialized from the base paragraph”?

paragraph1 = new Paragraph(textholder.getParagraphs().get(0));

Something like this?

hi!!

attatching the base presentation file, from where we get the slides and the paragraph.

the same slide is cloned as many times as we require and as u can see the placeholder.get(1) has 4 paragraphs.

depending upon the data we add the paragraphs to the cloned slides

{

/*this slide0 is from the sample.ppt which i have attatched*/

Slide slide0 = slides.get(0);
Slide cloneSlide = cloneTheSlide(slide0, indexSubItem);
indexSubItem++;

Placeholders pholders = cloneSlide.getPlaceholders();

//for the paragraph
Placeholders pholdersBase = slides.get(0).getPlaceholders();
TextHolder thBase = (TextHolder) pholdersBase.get(1);
Paragraphs parasBase = thBase.getParagraphs();

Paragraph paragraph0 = null;

paragraph0 = new Paragraph(parasBase.get(0));
slideTempTitle = templateTitle;
paras.add(indexItem,paragraph0);

paras.get(indexItem).getPortions().get(0).setText("titleDesc);

}

this function is called many times depending upon the length of the Collection.

so number of slides are cloned and paragraphs are added.

Thank U

Regards