You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by jeevan86 <ch...@gmail.com> on 2015/09/07 10:03:10 UTC

Apply slide master and create new layouts

Hi,
Need help in only retaining an existing ppt's slidemaster and create new
layouts. I am using the following code to achieve the same on linux machine
but Null Pointers are scaring me.

Exception in thread "main" java.lang.NullPointerException
	at
org.apache.poi.xslf.usermodel.XMLSlideShow.createSlide(XMLSlideShow.java:223)

Code I am using :
    
   *XMLSlideShow ppt = new XMLSlideShow(new FileInputStream("test.pptx"));
    
    XSLFSlideMaster defaultMaster = ppt.getSlideMasters()[0];
    
    XSLFSlideLayout layout1 =
defaultMaster.getLayout(SlideLayout.VERT_TITLE_AND_TX);
    XSLFSlide slide1 = ppt.createSlide(layout1);

    XSLFSlideLayout layout2 =
defaultMaster.getLayout(SlideLayout.SECTION_HEADER);
    XSLFSlide slide2 = ppt.createSlide(layout2);

    FileOutputStream out = new FileOutputStream(file);
    ppt.removeSlide(0);
    ppt.write(out);
    out.close();*

As told, the above code works perfectly when the pptx is using the default
white and white theme but not  when I make any changes to the master theme.

Any help would be of great help to me.

Thanks in Advance,
Jeevan



--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Apply-slide-master-and-create-new-layouts-tp5720079.html
Sent from the POI - Dev mailing list archive at Nabble.com.

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


Re: Apply slide master and create new layouts

Posted by jeevan86 <ch...@gmail.com>.
Hi Guys,
Does anyone have an idea as to why POI doesn't expose any public method to
add a new layout to our SlideMaster?

Thanks in Advance,
Jeevan



--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Apply-slide-master-and-create-new-layouts-tp5720079p5720106.html
Sent from the POI - Dev mailing list archive at Nabble.com.

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