Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?
- require_once '../libs/PHPWord.php';
- //$PHPWord = new PHPWord();
- $include_headers = false;
- // Create a new PHPWord Object
- $PHPWord = new PHPWord();
- // Every element you want to append to the word document is placed in a section. So you need a section:
- $section = $PHPWord->createSection();
- $Text_to_Add = htmlentities("Me & my Code");
- $section->addText($Text_to_Add);
- // At least write the document to webspace:
- header("Cache-Control: public");
- header("Content-Description: File Transfer");
- header("Content-Disposition: attachment; filename=helloWorld.docx");
- header("Content-Type: application/docx");
- header("Content-Transfer-Encoding: binary");
- $objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'Word2007');
- $objWriter->save('helloWorld.docx');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement