Independentsoft
Home
Products
Purchase
Support
Downloads
Company
Contact
JODF
>
Tutorial
> Append document
The example shows you how to append content of one document to content of another document.
import com.independentsoft.office.odf.ITextContent; import com.independentsoft.office.odf.TextDocument; public class Example { public static void main(String[] args) { try { TextDocument first = new TextDocument("c:\\test\\first.odt"); TextDocument second = new TextDocument("c:\\test\\second.odt"); for (ITextContent bodyElement : second.getBody().getContent()) { first.getBody().add(bodyElement); } first.save("c:\\test\\output.odt", true); } catch (Exception e) { System.out.println(e.getMessage()); e.printStackTrace(); } } }