Solve: Content not readable in WORD, when making a Report with PHPWORD

0

Hi, I have a problem, I'm working with PHPWORD, more specifically with TemplateProcessor, all right in the code apparently, but when I download my report it does not open and I get the following message that I attached in image:

Here is the part of the code where I made the data entry, it should be noted that the data is correctly obtained:

$nameegresado=($_POST["nameeg"]);
$apepegresado=($_POST["ape"]);
$apemegresado=($_POST["ame"]);
$carreraegresado=($_POST["carre"]);
$matriculaegresado=($_POST["matriculae"]);


$templateWord->setValue('nombre_estudiante',$nameegresado);
$templateWord->setValue('carrera_estudiante',$carreraegresado);
$templateWord->setValue('matricula_estudiante',$matriculaegresado);

$templateWord->saveAs('Documento02.docx');

   header("Content-type: 
  application/vnd.ms-word");
  header('Content- 
  Disposition: attachment;filename="'.$carrera.    egresado.'.doc"');
  header('Cache-Control: max-age=0');

 echo file_get_contents('Documento02.docx');
    
asked by Erick E. CoPa 08.05.2018 в 14:20
source

0 answers