DescriptionDocumentationExamplesLinksLicenseFuture plansDevelopersDownloads
Flag Flag

If you like this script, please rate it at:

Cíclope project logo

Examples

Scripts

Here are some little examples that show you how to start to create some simple documents. These examples works with the latest version of the library (currently 0.3 version).

  1. Simple example: insert text
  2. Text styles and line breaks
  3. Textboxes
  4. Images
  5. Header, footer and meta-information
  6. Tables
  7. Some drawings
  8. <?php
    require_once('../lib/include.php');
    import('phpdocwriter.pdw_document');
    import('phpdocwriter.pdw_header');
    import('phpdocwriter.pdw_footer');

    $sxw = new pdw_document;

    $sxw->SetLanguage('es','ES');
    $sxw->SetStdFont ("Times New Roman",10);
    $sxw->AddPageDef(array('name'=>'Standard','margins'=>'2,2,2,2'));

    $head = new pdw_header($sxw,'Standard');
    $head->Ln();
    $head->Image(array('path'=>'logo.png','w'=>4.12,'h'=>1.92));
    $head->Insert();

    $foot = new pdw_footer($sxw,'Standard');
    $foot->Ln();
    $foot->AddLink ("PHP DocWriter","http://phpdocwriter.sourceforge.net");
    $foot->Insert();

    $sxw->SetTitle ('Documento de prueba');
    $sxw->SetAuthor ('José Manuel Sánchez');
    $sxw->SetSubject ('Documento para probar el funcionamiento de phpdocwriter');
    $sxw->SetKeyWords ('php,OpenOffice.org,phpdocwriter');
    $sxw->Write ('Insertamos una cabecera y pie de página');

    $sxw->Output();
    ?>

    You can generate the OpenOffice.org document corresponding to this script, to do that click here.