importjava.io.File;importjava.io.FileOutputStream;importjava.io.IOException;importorg.apache.poi.xslf.usermodel.SlideLayout;importorg.apache.poi.xslf.usermodel.XMLSlideShow;importorg.apache.poi.xslf.usermodel.XSLFHyperlink;importorg.apache.poi.xslf.usermodel.XSLFSlide;importorg.apache.poi.xslf.usermodel.XSLFSlideLayout;importorg.apache.poi.xslf.usermodel.XSLFSlideMaster;importorg.apache.poi.xslf.usermodel.XSLFTextRun;importorg.apache.poi.xslf.usermodel.XSLFTextShape;publicclassHyperlinkToPPT{publicstaticvoidmain(String args[])throwsIOException{//create an empty presentationXMLSlideShow ppt =newXMLSlideShow();//getting the slide master objectXSLFSlideMaster slideMaster = ppt.getSlideMasters()[0];//select a layout from specified listXSLFSlideLayout slidelayout = slideMaster.getLayout(SlideLayout.TITLE_AND_CONTENT);//creating a slide with title and content layoutXSLFSlide slide = ppt.createSlide(slidelayout);//selection of title place holderXSLFTextShape body = slide.getPlaceholder(1);//clear the existing text in the slide
body.clearText();//adding new paragraphXSLFTextRun textRun = body.addNewTextParagraph().addNewTextRun();//setting the text
textRun.setText("Tutorials point");//creating the hyperlinkXSLFHyperlink link = textRun.createHyperlink();//setting the link address
link.setAddress("http://www.cainiaoya.com/");//create the file objectFile file =newFile("C:/poippt/hyperlink.pptx");FileOutputStream out =newFileOutputStream(file);//save the changes in a file
ppt.write(out);System.out.println("slide cretated successfully");
out.close();}}