首页 > 解决方案 > ckediter文本如何在word文件中转换?它没有打开任何人都可以帮助我吗?

问题描述

我在 Laravel 中做了一个块我在 textarea 中使用 ckeditor 并使用 Laravel 以 word 格式下载该文本文件,但它没有打开并给出错误 XML 解析错误

我下载word文件

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

我想用我下载的word打开文件

标签: phplaravellaravel-5

解决方案


推荐阅读