With jOpenDocument you can create a complete document from an empty page. We provide a high level API to create the elements of your document.
The complete source code (provided in a packaged eclipse project) is available in the benchmark section.
The key class is ODSingleXMLDocument, it represents a document with content and style.
The easy way to get one is to use an empty document from OpenOffice, and load it :
To create a paragraph or a heading, we provide the classes: Paragraph and Heading.
In this example the style of the heading is defined in the styles.odt file, we just need to reference it from its name. The paragraph is created the same way. After creating and configuring the Paragrah and Heading, we can add them to the ODSingleXMLDocument.
The last step in done by calling saveAs on our ODPackage.