added example how to merge .pptx slides

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1231850 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Yegor Kozlov 2012-01-16 07:00:04 +00:00
parent 2cf6b568c6
commit 532d527f98

View File

@ -50,6 +50,7 @@
<li><link href="#Text">Format text</link></li> <li><link href="#Text">Format text</link></li>
<li><link href="#Hyperlinks">Hyperlinks</link></li> <li><link href="#Hyperlinks">Hyperlinks</link></li>
<li><link href="#PPTX2PNG">Convert .pptx slides into images</link></li> <li><link href="#PPTX2PNG">Convert .pptx slides into images</link></li>
<li><link href="#Merge">Merge multiple presentations together</link></li>
</ul> </ul>
</section> </section>
<section><title>Cookbok</title> <section><title>Cookbok</title>
@ -276,7 +277,28 @@ Options:
example demonstrates how to use Apache Batik to convert .pptx slides into SVG format. example demonstrates how to use Apache Batik to convert .pptx slides into SVG format.
</p> </p>
</section> </section>
<anchor id="Merge"/>
<section>
<title>Merge multiple presentations together</title>
<source>
XMLSlideShow ppt = new XMLSlideShow();
String[] inputs = {"presentations1.pptx", "presentation2.pptx"};
for(String arg : inputs){
FileInputStream is = new FileInputStream(arg);
XMLSlideShow src = new XMLSlideShow(is);
is.close();
for(XSLFSlide srcSlide : src.getSlides()){
ppt.createSlide().importContent(srcSlide);
}
}
FileOutputStream out = new FileOutputStream("merged.pptx");
ppt.write(out);
out.close();
</source>
</section>
</section> </section>
</section> </section>
</body> </body>