OpenDocument
[ class tree: OpenDocument ] [ index: OpenDocument ] [ all elements ]

Source for file create.php

Documentation is available at create.php

  1. <?php
  2. require_once 'OpenDocument.php'// open document class
  3.  
  4. //create a new OpenDocument Text file
  5. $odt OpenDocument::text();
  6. //add heading
  7. $h $odt->createHeading('Heading'1);
  8. //create paragraph
  9. $p1 $odt->createParagraph('Paragraph 1');
  10. //set paragraph styles
  11. $p1->style->fontSize = '12pt';
  12. $p1->style->fontName = 'Times New Roman';
  13. $p1->style->color = '#009900';
  14. $p1->style->underlineStyle = 'dotted';
  15. $p1->style->underlineColor = '#009999';
  16. $p1->style->underlineWidth = '2pt';
  17.  
  18. //create second paragraph
  19. $p2 $odt->createParagraph('Paragraph 2');
  20. //copy styles from first one
  21. $p2->style->copy($p1->style);
  22. //insert space into paragraph
  23. $p1->createTextElement(' ');
  24. //create a link inside a paragraph
  25. $a1 $p1->createHyperlink('''http://ya.ru''simple''_self''link');
  26. //insert text in link
  27. $span $a1->createSpan('Ya.ru');
  28. //apply color to text
  29. $span->style->color = '#000099';
  30. //insert space to heading
  31. $h->createTextElement(' ');
  32. //create link in heading
  33. $a2 $h->createHyperlink('Ya.ru''http://ya.ru');
  34. //apply underline color to link
  35. $a2->style->underlineColor = '#990000';
  36.  
  37. //save as test.odt
  38. $odt->save('test.odt');
  39.  
  40. echo "saved as test.odt\n";
  41. ?>

Documentation generated on Mon, 11 Mar 2019 15:51:01 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.