Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require 'vendor/autoload.php';
- $phpWord = new PhpOfficePhpWordPhpWord();
- $document = $PHPWord->loadTemplate('Template.docx'); //шаблон
- $document->setValue('d_num', '777'); //номер договора
- $document->setValue('d_date', '04.10.2014'); //дата договора
- $document->setValue('last_name', 'Никоненко'); //фамилия
- $document->setValue('name', 'Сергей');// имя
- $document->setValue('surname', 'Васильевич');// отчество
- header("Content-Description: File Transfer");
- header('Content-Disposition: attachment; filename="my dream.docx"');
- header('Content-Type: application/vnd.openxmlformats-
- officedocument.wordprocessingml.document');
- header('Content-Transfer-Encoding: binary');
- header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
- header('Expires: 0');
- $xmlWriter = PhpOfficePhpWordIOFactory::createWriter($phpWord,
- 'Word2007');
- $xmlWriter->save("php://output");
Add Comment
Please, Sign In to add comment