A pure Java library for OASIS Open Document files manipulation

Merge mutiple text files

jOpenDocument allows you to concatenate multiple text documents.


  // Load 2 text documents
  File f1 = new File("template/ooo2flyer_p1.odt");
  ODSingleXMLDocument p1 = ODSingleXMLDocument.createFromPackage(f1);

  File f2 = new File("template/ooo2flyer_p2.odt");
  ODSingleXMLDocument p2 = ODSingleXMLDocument.createFromPackage(f2);

  // Concatenate them

  // Save to file and Open the document with ! File("cat")));

First you load the documents that you want to concatenate. Then you use the add() method and save the resulting document (the .odt extension is automatically added).

All the sytles are properly merged.

If you want to know more, look at the package org.jopendocument.dom

The complete example is located in org/jopendocument/sample/