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