Hi,
My problem is that, i can't import a embedded xls-file in to a ppt slide.
Does anyone have a solution for this problem?
Thank you for your help.
Here is my code:
class createPPT {
public static void main(String[] args) throws IOException, OpenXML4JException, XmlException{
//load existing ppt-file with embedded files
XMLSlideShow ppt = new XMLSlideShow(new FileInputStream("C:\\Users\\..."));
//get the layout of the slide master
XSLFSlideLayout layout_ppt = ppt.getSlideMasters()[0].getLayout(ppt.getSlideMasters()[0].getSlideLayouts()[0].getType());
//create a new ppt-slide
XSLFSlide slide = ppt.createSlide(layout_ppt);
//save all embedded files in listemb, the first item is a xls-file
java.util.List<PackagePart> listemb = ppt.getAllEmbedds();
//load xls-file in poifs
POIFSFileSystem poifs = new POIFSFileSystem(listemb.get(0).getInputStream());
//here i want to import the embedded xls-file in a new ppt-slide
...
//save new ppt-file
FileOutputStream out = new FileOutputStream("C:\\Users\\...");
ppt.write(out);
out.close();
}
}
My problem is that, i can't import a embedded xls-file in to a ppt slide.
Does anyone have a solution for this problem?
Thank you for your help.
Here is my code:
class createPPT {
public static void main(String[] args) throws IOException, OpenXML4JException, XmlException{
//load existing ppt-file with embedded files
XMLSlideShow ppt = new XMLSlideShow(new FileInputStream("C:\\Users\\..."));
//get the layout of the slide master
XSLFSlideLayout layout_ppt = ppt.getSlideMasters()[0].getLayout(ppt.getSlideMasters()[0].getSlideLayouts()[0].getType());
//create a new ppt-slide
XSLFSlide slide = ppt.createSlide(layout_ppt);
//save all embedded files in listemb, the first item is a xls-file
java.util.List<PackagePart> listemb = ppt.getAllEmbedds();
//load xls-file in poifs
POIFSFileSystem poifs = new POIFSFileSystem(listemb.get(0).getInputStream());
//here i want to import the embedded xls-file in a new ppt-slide
...
//save new ppt-file
FileOutputStream out = new FileOutputStream("C:\\Users\\...");
ppt.write(out);
out.close();
}
}