You need to call importContent on the slide layout too. Add the following line to your code:
XSLFSlideLayout src_sl = slide.getSlideLayout(); XSLFSlideLayout new_sl = newSlide.getSlideLayout(); new_sl.importContent(src_sl); Yegor On Thu, Jan 10, 2013 at 4:28 PM, Georgi Sokolov <[email protected]> wrote: > Guys, > > I have the following problem with the current 3.9 version of the components. > I couldn't see answer anywhere in the mailing list. > > I have been using the library with great success to read and split/merge > PPTX files. The only problem that I have is that when I merge 2 > presentations, it does not copy the Master pages. What I want to do is: > > If we have the following input files: > > presentation1.pptx > presentation2.pptx > > And an empty: > > out.pptx > > I want to get slide 5 from presentation1.pptx and slide 3 from > presentation2.pptx and put them as slides 1 and 2 in out.pptx. > > It works fine for the content but if I have some background/layout set in > the master page for the page 5, it does not copy it. I tried almost > everything, including some snippets that I got off the internet like: > > XMLSlideShow ppt = new XMLSlideShow(file); > XMLSlideShow ppt_out = new XMLSlideShow(); > > XSLFSlide slide = ppt.getSlides()[0]; > XSLFSlide newSlide = ppt_out.createSlide(); > > XSLFSlideMaster src_sm = slide.getSlideMaster(); > XSLFSlideMaster new_sm = newSlide.getSlideMaster(); > > new_sm.importContent(src_sm); > newSlide.importContent(slide); > > This does not work though, nothing of the original master gets copied. Is it > a problem with the library or something I'm doing wrong? If it is a problem > with the library, do we have some ETA when we think this will get resolved? > Can I help somehow? > > Georgi > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
