Без опису

1234567891011121314151617181920212223
  1. <?php
  2. include_once 'Sample_Header.php';
  3. // New Word Document
  4. echo date('H:i:s') , ' Create new PhpWord object' , EOL;
  5. $phpWord = new \PhpOffice\PhpWord\PhpWord();
  6. $section = $phpWord->addSection();
  7. $html = '<h1>Adding element via HTML</h1>';
  8. $html .= '<p>Some well formed HTML snippet needs to be used</p>';
  9. $html .= '<p>With for example <strong>some<sup>1</sup> <em>inline</em> formatting</strong><sub>1</sub></p>';
  10. $html .= '<p>Unordered (bulleted) list:</p>';
  11. $html .= '<ul><li>Item 1</li><li>Item 2</li><ul><li>Item 2.1</li><li>Item 2.1</li></ul></ul>';
  12. $html .= '<p>Ordered (numbered) list:</p>';
  13. $html .= '<ol><li>Item 1</li><li>Item 2</li></ol>';
  14. \PhpOffice\PhpWord\Shared\Html::addHtml($section, $html);
  15. // Save file
  16. echo write($phpWord, basename(__FILE__, '.php'), $writers);
  17. if (!CLI) {
  18. include_once 'Sample_Footer.php';
  19. }