mirror of https://github.com/apache/poi.git
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:
parent
c15348c065
commit
797ff02699
|
@ -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,7 +277,28 @@ 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>
|
||||
</body>
|
||||
|
|
Loading…
Reference in New Issue