Examples

This would be an example of a document generated with this library: Example1

This example would be generated with the next code:


require("oxml.php");
$d = new oxml_wordml("example1");

$d->changeStyles('/usr/local/apache2/htdocs/oxml/styles.xml');
$d->changeNumberings('/usr/local/apache2/htdocs/oxml/numbering.xml');

$t = new oxml_toc();
$d->addToc($t);

$ppt1 = new oxml_propParagraph();
$ppt1->pStyle="Ttulo1";
$d->addParagraph(new oxml_Paragraph($ppt1,"First Title"));

$p = new oxml_Paragraph();
$p->addText("This is the text of the paragraph");
$d->addParagraph($p);

$p = new oxml_Paragraph($ppt1);
$p->addText("Second Title");
$d->addParagraph($p);

$pt = new oxml_propText();
$pt->font="Arial";
$pt->fontsize=16;
$pt->bold=1;

$p = new oxml_Paragraph();
$p->addText("Now we change the font ");
$p->addText("OF THIS TEXT ", $pt);
$p->addText(" until here.");
$d->addParagraph($p);

$p = new oxml_Paragraph($ppt2);
$p->addText("First Subtitle");
$d->addParagraph($p);

$pp = new oxml_propParagraph();
$pp->indleft=1;
$pp->indright=1;
$pp->indfirstLine=0.5;
$pp->alignment="both";
$pp->spaceAfter=6;
$pp->spaceBefore=6;
$pp->spaceInter=15;

$p = new oxml_Paragraph($pp);
$p->addText("If my poor Flatland friend retained the vigour of mind which he enjoyed when he began to compose these Memoirs, I should not now need to represent him in this preface, in which he desires, firstly, to return his thanks to his readers and critics in Spaceland, whose appreciation has, with unexpected celerity, required a second edition of his work; secondly, to apologize for certain errors and misprints");
$d->addParagraph($p);

$pt = new oxml_propTable();
$pt->tamBorder=1;
$pt->alignment="center";
$pt->width = 100;

$pp = new oxml_propParagraph();
$pp->alignment="center";

$t = new oxml_table();
$t->setProperties($pt);
$t->addElement(0,0,new oxml_Paragraph($pp,"Elem1"));
$t->addElement(0,1,new oxml_Paragraph($pp,"Elem2"));
$pr = new oxml_propTableRow();
$pr->Header=1;
$t->setRowProperties(0,$pr);
$t->addElement(1,0,new oxml_Paragraph(NULL,"Elem3"));
$t->addElement(1,1,new oxml_Paragraph(NULL,"Elem4"));
$pc = new oxml_propTableCell();
$pc->width = 20;
$pc->fill = "C3D69B";
$t->addElement(2,0,new oxml_Paragraph(NULL,"Elem5"),$pc);
$t->addElement(2,1,new oxml_Paragraph(NULL,"Elem6"));
$d->addTable($t);

$p = new oxml_picture();
$p->file = '/tmp/book.jpg';
$p->filename = "book.jpeg";

$d->addParagraph(new oxml_Paragraph());
$d->addPicture($p);
$d->addParagraph(new oxml_Paragraph());

$d->addParagraph(new oxml_Paragraph(NULL,"New paragraph"));

$d->generate();
$d->sendHTTP();