Add Transitions to Powerpoint Slides in Java

Import Dependency (2 Methods)

● Download the free library and unzip it, and then add the Spire.Presentation.jar file to your project as dependency.
● Directly add the jar dependency to your maven project by adding the following configurations to the pom.xml.

<repositories>
<repository>
<id>com.e-iceblue</id>
<name>e-iceblue</name>
<url>http://repo.e-iceblue.com/nexus/content/groups/public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>e-iceblue</groupId>
<artifactId>spire.presentation.free</artifactId>
<version>5.1.0</version>
</dependency>
</dependencies>

Sample Code

The Islide.getSlideShowTransition().setType() method, Islide.getSlideShowTransition().setSoundMode() method and Islide.getSlideShowTransition().setSpeed() method offered by Free Spire.Presentation for Java allow you to set transition type, sound mode and speed for the specified slides. The complete sample code are as follows:

import com.spire.presentation.*;
import com.spire.presentation.drawing.transition.*;

public class setTransitions {
public static void main(String[] args) throws Exception{

//Load a PowertPoint document
Presentation presentation = new Presentation();
presentation.loadFromFile("Symbolism.pptx");

//Set the first slide transition as push and sound mode
presentation.getSlides().get(0).getSlideShowTransition().setType(TransitionType.PUSH);
presentation.getSlides().get(0).getSlideShowTransition().setSoundMode(TransitionSoundMode.START_SOUND);

//Set the second slide transition as split and set the speed
presentation.getSlides().get(1).getSlideShowTransition().setType(TransitionType.SPLIT);
presentation.getSlides().get(1).getSlideShowTransition().setSpeed(TransitionSpeed.SLOW);

//Save the file
presentation.saveToFile("setTransitions.pptx", FileFormat.PPTX_2010);
presentation.dispose();
}
}

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store