This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Dec 30th, 2011  |  syntax: None  |  size: 0.77 KB  |  views: 148  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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');
clone this paste RAW Paste Data