jeudi 23 mai 2019

how ckediter text convert in word file it did not open

i made a block in laravel i use ckeditor in textarea and download that text file in word formate using laravel but it not open and give error xml parse error

i download word file

   $data= Templete::where('id',$id)->first();
   $wordTest= new \PhpOffice\PhpWord\PhpWord();
   $newSection= $wordTest->addSection();
   $wordText = $data['word'];
   $newSection->addText($wordText);
   $objectWriter = \PhpOffice\PhpWord\IOFactory::createWriter($wordTest,'Word2007');
   try
   {
       $objectWriter->save(storage_path('TestWordFile.docx'));
   }
   catch(Exception $e) {
   }
   return response()->download(storage_path('TestWordFile.docx'));
   // Templete::where('id',$id)->delete();
   session()->flash('message','file download ');
   return redirect()->to('/text');

i want open file in word which i download



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire