Docxpresso comes bundle with a default template that can be found in the files/template folder.
This template comes already bundled with all the (minimum) required elements but this, by no means, imply that you could not use your own templates to build your documents.

Docxpresso templates must be .odt files (Open Document Format text files) that can be generated either with Libre Office, Open Office or Word (we recommend 2010 or later).

The .odt format is the native Libre and Open Office text editors format but it can also be open and saved by Word 2007 SP2 and later versions of Word.

To use a custom template is extremely simple: you should only invoke the CreateDocument class with the option template set to its corresponding local path.

if we run one of our previous examples with a custom template that includes a nicely formatted front page we get:

 * This sample script generates a sample
 * document out of HTML code with a custom
 * template
require_once 'pathToDOCXPRESSO/';
$doc = new Docxpresso\CreateDocument(array('template' => 'customdoc.odt'));
$format = '.pdf';//.pdf, .doc, .docx, .odt, .rtf
         * {font-family: Arial; font-size: 10pt}
         h1 {margin-top: 25pt}
         h2 {margin: 25pt 0 5pt 0}
         p {margin-bottom: 10pt}
         th {background-color: #5B9BD5; padding: 3px 7px}
         th p {color: #f6f6f6; font-weight: bold; font-size: 10pt; margin: 0}
         td {padding: 3px 7px; border: 0.5pt solid #ffffff}
         td p {color: #333; font-size: 10pt; margin: 0}
         li {margin-bottom: 5pt}
         li li {font-style: italic; color: #555;}
         header {height: 1.5cm}
         .headerTable {width: 15cm}
         .headerTable td {border: none; border-bottom: 0.5pt solid #333}
         .headerTable td.left {text-align: right; width: 5cm; background-color: #b74400}
         .headerTable td.left p {color: #ffffff}
         .headerTable td.middle {color: #333; width: 8cm}
         .headerTable td.right {text-align: right; color: #333; width: 2cm}
         .summary {margin: 10pt 40pt; text-align: justify}
         .footnote {font-size: 9pt}
         .image {text-align: center}
         .nice {width: 12cm; margin: auto}
         .firstCol {background-color: #5B9BD5;}
         .firstCol p {color: #f6f6f6; font-weight: bold; font-size: 10pt; margin: 0}
         .even {background-color: #BDD6EE;}
         .odd {background-color: #DEEAF6}
        <h1>Sample document</h1>
        <p class="summary"><strong>Summary. </strong> This is a document created out from HTML5 and CSS code. 
                The document includes a few standard document elements to better illustrate the package functionality.</p>
        <h2>Some random content</h2>
        <p>This is a paragraph where we are going to include a couple of elements. Here we include a 
        footnote<footnote><span class="footnote">To include a footnote is as simple as this.</span></footnote> and also a link to
        <a href="">DOCXPRESSO</a> website.</p>
        <p class="image"><img src="scene.jpg"/></p>
        <h2>A nice table</h2>
        <p>Let us include a nicely formatted table:</p>
        <table class="nice">
                <th><p>First Column</p></th>
                <th><p>Second Column</p></th>
                <th><p>Third Column</p></th>
                <td class="firstCol"><p>Row 1</p></td>
                <td class="even"><p>C_1_1</p></td>
                <td class="even"><p>C_1_2</p></td>
                <td class="firstCol"><p>Row 2</p></td>
                <td class="odd"><p>C_2_1</p></td>
                <td class="odd"><p>C_2_2</p></td>
                <td class="firstCol"><p>Row 3</p></td>
                <td class="even"><p>C_3_1</p></td>
                <td class="even"><p>C_3_2</p></td>
        <h2>A nested list</h2>
        <p>In order to finish the example a nested list: </p>
            <li>This item has a <strong>sublist</strong>:
                    <li>Subitem 1.</li>
                    <li>Subitem 2.</li>
            <li>The final item.</li>
//insert the HTML
$doc->html(array('html' => $html));
//include in the render method the path where you want your document to be saved
$doc->render('template_HTML' . $format); 
//echo a link to the generated document
echo 'You may download the generated document from the link below:<br/>';
echo '<a href="' . 'template_HTML' . $format . '">Download document</a>';

DOWNLOAD:download pdfdownload docdownload docxdownload odtdownload rtf

To generate a custom template that render nice results in all possible formats may show sometimes tricky. Beware that the RTF format does not render well sophisticated shapes so in the previous sample the front page rendering is rather poor.