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 = new OpenDocument;
  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. //create second paragraph
  18. $p2 $odt->createParagraph('Paragraph 2');
  19. //copy styles from first one
  20. $p2->style->copy($p1->style);
  21. //insert space into paragraph
  22. $p1->createTextElement(' ');
  23. //create a link inside a paragraph
  24. $a1 $p1->createHyperlink('''http://ya.ru''simple''_self''link');
  25. //insert text in link
  26. $span $a1->createSpan('Ya.ru');
  27. //apply color to text
  28. $span->style->color = '#000099';
  29. //insert space to heading
  30. $h->createTextElement(' ');
  31. //create link in heading
  32. $a2 $h->createHyperlink('Ya.ru''http://ya.ru');
  33. //apply underline color to link
  34. $a2->style->underlineColor = '#990000';
  35. //save as test.odt
  36. $odt->save('test.odt');
  37.  
  38. echo 'saved as test.odt';
  39. ?>

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