jOpenDocument


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 file1 = new File("template/ooo2flyer_p1.odt");
  OOSingleXMLDocument p1 = OOSingleXMLDocument.createFromFile(file1);

  File file2 = new File("template/ooo2flyer_p2.odt");
  OOSingleXMLDocument p2 = OOSingleXMLDocument.createFromFile(file2);

  // Concatenate them
  p1.add(p2);

  // Save to file and Open the document with OpenOffice.org !
  OOUtils.open(p1.saveAs(new File("cat.odt")));
Java2html

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

All the sytles are properly merged.

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