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 c15348c065
commit 797ff02699
1 changed files with 23 additions and 1 deletions

View File

@ -50,6 +50,7 @@
<li><link href="#Text">Format text</link></li>
<li><link href="#Hyperlinks">Hyperlinks</link></li>
<li><link href="#PPTX2PNG">Convert .pptx slides into images</link></li>
<li><link href="#Merge">Merge multiple presentations together</link></li>
</ul>
</section>
<section><title>Cookbok</title>
@ -276,6 +277,27 @@ Options:
example demonstrates how to use Apache Batik to convert .pptx slides into SVG format.
</p>
</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>