Section.php 843 B

1234567891011121314151617181920212223242526
  1. <?php
  2. require_once '../PHPWord.php';
  3. // New Word Document
  4. $PHPWord = new PHPWord();
  5. // New portrait section
  6. $section = $PHPWord->createSection(array('borderColor'=>'00FF00', 'borderSize'=>12));
  7. $section->addText('I am placed on a default section.');
  8. // New landscape section
  9. $section = $PHPWord->createSection(array('orientation'=>'landscape'));
  10. $section->addText('I am placed on a landscape section. Every page starting from this section will be landscape style.');
  11. $section->addPageBreak();
  12. $section->addPageBreak();
  13. // New portrait section
  14. $section = $PHPWord->createSection(array('marginLeft'=>600, 'marginRight'=>600, 'marginTop'=>600, 'marginBottom'=>600));
  15. $section->addText('This section uses other margins.');
  16. // Save File
  17. $objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'Word2007');
  18. $objWriter->save('Section.docx');
  19. ?>