Creating new PPT docu

I’d like to know if I can use the component to create a new ppt document by inserting slides from other ppt docs.

Yes, you can. You should create template (ppt with one empty slide) and use
Presentation.CloneSlide function to copy slides from other presentations to template.

Let me explain a little further… I want to write an application which takes an input X number of PPT files, and then creates a new PPT file with the Nth slide from each of the input files. The app also needs to save the “new” ppt on the server.

So I will NOT be able to create a template file manually… If I were to manually place a template file, what would happen if concurrent users use the application at the same time?

What am I missing?

Bijoy

Dear Bijoy,

You can put template file on the server or to the application’s resource and read it.
Aspose.PowerPoint must have read-only access to this file. This part is thread safe so
any number of users can work simultaneously.

After you open template file you can add slides from other ppt files.
At the and you should delete first empty slide and save result to the separate ppt file on the server.

Please check Aspose.PowerPoint.CloneSlides demo.

Ok… Thanks for the information.

When I clone a slide from pres1 to pres2, the pictures don’t seem to get carried over. ie. if slide N in pres 1 contains a picture, the slide when cloned displays a “red X” instead of the picture.

How do I get the pictures carried over? If there is a way, can I ONLY copy over pictures associated with the cloned slide? as opposed to copying over ALL the pictures?

Thanks for your help.

Bijoy

public Slide CloneSlide(Slide,int); function is for cloning slides inside one presentation.
For cloning slides to another presentation you should use:
public Slide CloneSlide(Slide,int,Presentation,SortedList);

Hi I’ve tried to copy slides in Java and some Exceptions were throwed.

First I used your CloneSlide example:
Exception in thread “main” java.lang.NoClassDefFoundError: com/sun/media/jai/codec/SeekableStream
at com.aspose.powerpoint.Presentation.(SourceFile:160)
at com.aspose.powerpoint.Presentation.(SourceFile:416)
at pl.pp.spike.CloneSlide.main(CloneSlide.java:35)

JAI is required?

It also didn’t work in my code.

TreeMap ids = new TreeMap();
for (Iterator iter = newSlides.iterator();iter.hasNext()) {
Slide slide = (Slide) iter.next();
if (slide.getSlidePosition() != 0) {
ids.clear();
Slide s = tempPres.cloneSlide( //LINE 109
slide,
newPres.getSlides().getLastSlidePosition()+1,
newPres, ids);
}
}
Where:
newSlides - List of slides to insert (slides from tempPress),
tempPres - source presentation,
newPres - presentation to add slides

Exception:
Exception in thread “AWT-EventQueue-0” java.lang.NullPointerException
at com.accpl.gui.CreatePresentationNavigationPanel$ForwardButtonListener.copySlides(CreatePresentationNavigationPanel.java:109)
at com.accpl.gui.CreatePresentationNavigationPanel$ForwardButtonListener.actionPerformed(CreatePresentationNavigationPanel.java:87)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)




Of course it should be
for (Iterator iter = newSlides.iterator();iter.hasNext(); ) {…

Hmm I have to install JAI to make it work and it’s working now.

Is JAI really required ?

JAI is not required for current release
but it was required for old versions and will be used in the future.