Aspose.Slides - Managing Slide Transitions

//Instantiate Presentation class that represents a presentation file
Presentation pres = new Presentation("data/presentation.pptx");

//Apply circle type transition on slide 1
pres.getSlides().get_Item(0).getSlideShowTransition().setType(TransitionType.Circle);

//Apply comb type transition on slide 2
pres.getSlides().get_Item(1).getSlideShowTransition().setType( TransitionType.Comb);

//Apply zoom type transition on slide 3
pres.getSlides().get_Item(2).getSlideShowTransition().setType(TransitionType.Zoom);

//Write the presentation to disk
pres.save("data/AsposeTransition.pptx",SaveFormat.Pptx);

System.out.println("First Transition File is saved.");

//==============================================================

//Instantiate a Presentation object that represents a PPT file
Presentation presentation = new Presentation("data/presentation.pptx");

//Apply circle type transition on slide 1
presentation.getSlides().get_Item(0).getSlideShowTransition().setType(TransitionType.Circle);


//Set the transition time of 3 seconds
//Set the transition time of 5 seconds
presentation.getSlides().get_Item(0).getSlideShowTransition().setAdvanceOnClick( true);
presentation.getSlides().get_Item(0).getSlideShowTransition().setAdvanceAfterTime (3000);

//Apply comb type transition on slide 2
presentation.getSlides().get_Item(1).getSlideShowTransition().setType( TransitionType.Comb);


//Set the transition time of 5 seconds
presentation.getSlides().get_Item(1).getSlideShowTransition().setAdvanceOnClick( true);
presentation.getSlides().get_Item(1).getSlideShowTransition().setAdvanceAfterTime (5000);

//Apply zoom type transition on slide 3
presentation.getSlides().get_Item(2).getSlideShowTransition().setType(TransitionType.Zoom);

//Set the transition time of 7 seconds
presentation.getSlides().get_Item(2).getSlideShowTransition().setAdvanceOnClick( true);
presentation.getSlides().get_Item(2).getSlideShowTransition().setAdvanceAfterTime (7000);

//Write the presentation to disk
presentation.save("data/AsposeTransition2.pptx",SaveFormat.Pptx);

Download Source Code

For More Examples, Please Visit Aspose Docs

Last edited Jul 21, 2014 at 3:27 PM by shoaibkhan, version 4