ckediter文本如何在Word文件中转换?它没有打开有人可以帮我吗?

时间:2019-05-23 09:21:33

标签: php laravel laravel-5

我在Laravel造了一个街区 我在文本区域中使用ckeditor并使用Laravel以word formate格式下载该文本文件,但未打开并给出错误XML解析错误

我下载文字文件

   $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');

我想用下载的单词打开文件

0 个答案:

没有答案