You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Georg417 <d....@gmx.de> on 2014/05/20 17:09:08 UTC

import embedded files like xls in a new ppt slide

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();
    }
}



--
View this message in context: http://apache-poi.1045710.n5.nabble.com/import-embedded-files-like-xls-in-a-new-ppt-slide-tp5715685.html
Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org