]> source.dussan.org Git - poi.git/commitdiff
added example how to merge .pptx slides
authorYegor Kozlov <yegor@apache.org>
Mon, 16 Jan 2012 07:00:04 +0000 (07:00 +0000)
committerYegor Kozlov <yegor@apache.org>
Mon, 16 Jan 2012 07:00:04 +0000 (07:00 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1231850 13f79535-47bb-0310-9956-ffa450edef68

src/documentation/content/xdocs/slideshow/xslf-cookbook.xml

index d13624b30be06d7d79b3a40f4ccec5bbe03ecf91..da0e683e114388ab2a8d0e2bd11046208c2bb4ba 100644 (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,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>