Creating a first text document

<?php/*** This script demonstrates how to create a new text document by* adding a headline and a paragraph containing a link.*/require_once 'OpenDocument.php';

$doc = new OpenDocument();$doc->createHeading('Welcome to OpenDocument!', 1);$p = $doc->createParagraph('This script serves as a demonstration of PEAR\'sOpenDocument package. You are invited to explore the capabilities of thispackage and to read the API documentation available at ');$p->createHyperlink('pear.php.net', 'http://pear.php.net/package/OpenDocument');$p->createTextElement('. Have fun!');

$doc->save('my-first-document.odt');?>

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.