3

I have tried merging two pptx files through java API (Apache POI) It worked for PPTX having only text Content.

I need help to merge two PPTX files without losing charts, tables, images, Themes etc. Are there any open source java API-s for this?

Dezso Gabos
  • 2,297
  • 5
  • 21
  • 29
Anuraag P
  • 31
  • 3
  • 1
    Currently POI ignores charts, so if you decide to use POI you would need to implement the copying yourself, i.e. you have low-level access to the chart/themes xmls and also need to handle the relationships – kiwiwings Feb 02 '17 at 16:36

1 Answers1

0

Disclosure: I work for Plutext

Plutext's Docx4j Enterprise Edition can merge complex presentations. You decide whether the output takes on the look of the first pptx, or retains the individual look/feel of the inputs. As simple usage is like so:

    String[] deck = {"deck1.pptx", "deck2.pptx"};               

    PresentationBuilder builder = new PresentationBuilder();            
    builder.setThemeTreatment(ThemeTreatment.RESPECT); // preserve appearance of each deck?

    for (int i=0 ; i< deck.length; i++) {

        // Create a SlideRange representing the slides in this pptx
        SlideRange sr = new SlideRange(
                (PresentationMLPackage)OpcPackage.load(
                                        new File(DIR_IN + deck[i])));

        // Add the slide range to the output
        builder.addSlideRange(sr);

    }

    builder.getResult().save(
            new File("OUT_MergeWholePresentations.pptx"));

Docx4j Enterprise Ed is a commercial product. I'm not aware of an open source solution which offers what you want via a high level API. As with POI, you could implement what you want yourself using open source docx4j/pptx4j's low level API, but to do so you'd need a decent understanding of the pptx file format and pptx4j. (docx4j/pptx4j use JAXB; POI uses XML Beans)

JasonPlutext
  • 15,352
  • 4
  • 44
  • 84