Creating an OpenDocument text document is really simple.
* This script demonstrates how to create a new text document by
* adding a headline and a paragraph containing a link.
$doc = new OpenDocument();
$doc->createHeading('Welcome to OpenDocument!', 1);
$p = $doc->createParagraph('This script serves as a demonstration of PEAR\'s
OpenDocument package. You are invited to explore the capabilities of this
package and to read the API documentation available at ');
$p->createTextElement('. Have fun!');
After creating an OpenDocument instance, there are several methods available to create actual content; all of them are prefixed with create.
All of those methods return the created object. This object has already been inserted at the end of the document.
When you are done, call OpenDocument::save() with the filename as only parameter to store the document on disk.
Until version 0.1.2, only relative filenames are allowed.