importjava.io.FileInputStream;importjava.io.FileOutputStream;importjava.io.IOException;importorg.apache.poi.xslf.usermodel.XMLSlideShow;importorg.apache.poi.xslf.usermodel.XSLFSlide;publicclassMergingMultiplePresentations{publicstaticvoidmain(String args[])throwsIOException{//creating empty presentationXMLSlideShow ppt =newXMLSlideShow();//taking the two presentations that are to be mergedString file1 ="C:/poippt/presentation1.pptx";String file2 ="C:/poippt/presentation2.pptx";String[] inputs ={file1, file2};for(String arg : inputs){FileInputStream inputstream =newFileInputStream(arg);XMLSlideShow src =newXMLSlideShow(inputstream);for(XSLFSlide srcSlide : src.getSlides()){//merging the contents
ppt.createSlide().importContent(srcSlide);}}String file3 ="C:/poippt/combinedpresentation.pptx";//creating the file objectFileOutputStream out =newFileOutputStream(file3);// saving the changes to a file
ppt.write(out);System.out.println("Merging done successfully");
out.close();}}