Advertisement
Guest User

Untitled

a guest
Dec 30th, 2011
753
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. <?
  2. require_once '../libs/PHPWord.php';
  3. //$PHPWord = new PHPWord();
  4. $include_headers = false;
  5.  
  6.  
  7.  
  8. // Create a new PHPWord Object
  9. $PHPWord = new PHPWord();
  10.  
  11. // Every element you want to append to the word document is placed in a section. So you need a section:
  12. $section = $PHPWord->createSection();
  13.  
  14. $Text_to_Add = htmlentities("Me & my Code");
  15. $section->addText($Text_to_Add);
  16.  
  17. // At least write the document to webspace:
  18. header("Cache-Control: public");
  19. header("Content-Description: File Transfer");
  20. header("Content-Disposition: attachment; filename=helloWorld.docx");
  21. header("Content-Type: application/docx");
  22. header("Content-Transfer-Encoding: binary");
  23. $objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'Word2007');
  24. $objWriter->save('helloWorld.docx');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement