Plutext

Merging Powerpoint presentations in Java

This page is about programmatically merging (as in concatenating or joining) Powerpoint presentations in Java, using MergePPtx. MergePptx is part of Plutext's commercial Docx4j Enterprise Edition.

It can use the slide masters and layouts from the first presentation, to "re-brand" subsequent presentations to have the same look and feel. Alternatively, the actual product can be set to retain the distinct look and feel of the original slides in each presentation if you want.

To try our online demo, please see here

MergePptx is part of Plutext's commercial Docx4j Enterprise Edition, but you can still use it if you are using Apache POI or Aspose.Slides.

You can download a trial version of Docx4j Enterprise from our products page (including as an Eclipse project ready to run); you’ll also find pricing and ordering info there.

Java API

Here is a basic example of use:


		String[] deck = {
				"pres1.pptx" ,"pres2.pptx", "pres3.pptx"
		};				
				
		PresentationBuilder builder = new PresentationBuilder();
		
		// Uncomment to retain look/feel of each presentation
		//builder.setThemeTreatment(ThemeTreatment.RESPECT);
		
		for (int i=0 ; i< deck.length; i++) {
					
			// Create a SlideRange representing the slides in this pptx
			SlideRange sr = new SlideRange(
					(PresentationMLPackage)OpcPackage.load(
											new File(DIR_IN + deck[i])));
			
			// Add the slide range to the output
			builder.addSlideRange(sr);		
		}
						
		builder.getResult().save(
				new File("/OUT_MergeWholePresentations.pptx"));

That example concatenates several entire slide decks, one after another, and "re-brands" them (since ThemeTreatment.RESPECT is not set).

But you could instead:

For further details, please see the manual.