Hi … thank you for your quick reply.
Iam really struggeling with this for hours now. Iam not getting the results I expect.
Here ist what iam trying to do. (PPT). I build some sample presentations for your to reproduce my mistakes. They are attached to this post. I can send you my complete test classes if you want to take a closer look at my code.
1. I created a new Presentation Object (target) with my “master2.ppt” as template:
new Presentation("…/master2.ppt");
2. I copied all slides of “source.ppt” to my target Presentation. In each slide I copied I replaced the master with the one from my target Presentation:
Slide sourceslide = presentation.getSlideByPosition(fromIndex);
sourceslide = presentation.cloneSlide(sourceslide, toIndex, target, new TreeMap();
Slide master = target.getMainMaster();
sourceslide.changeMaster(master);</code></div><div><code>target.deleteUnusedMasters();</code></div><div><br></div><div>3. I wrote the target presentation to file system and removed the unused slide from my "master2.ppt" template. </div><div><br></div><div><div><code>Slide toRemove = this.presentation.getSlideByPosition(this.presentation.getSlides().size());</code></div><div><code>this.presentation.getSlides().remove(toRemove);</code></div><div><code>this.presentation.write(new FileOutputStream(file));</code></div></div><div><code><br></code></div><div>Can you please take a look at the result presenation and explain to me why I and up with more than 20 master slides?? I really dont get what Iam doing wrong. </div><div><br></div><div>thank you .. </div><div>btauber</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span></div>