WPS can be garbled in Excel after exporting Excel because of the problem of how the class is exported
Put $objwriter = new \phpexcel_writer_excel2007 ($this->_obj);
Replace with $objwriter = \phpexcel_iofactory::createwriter ($this->_obj, ' Excel5 '); We can solve the problem.
Public functionOutput$file _name){ //Direct output to browser Header("Pragma:public"); Header("expires:0"); Header("Cache-control:must-revalidate, post-check=0, pre-check=0"); Header("Content-type:application/force-download"); Header("Content-type:application/ms-execl"); Header("Content-type:application/octet-stream"); Header("Content-type:application/download"); Header(' Content-disposition:attachment;filename= '.$file _name); Header("Content-transfer-encoding:binary"); //$objWriter = new \phpexcel_writer_excel2007 ($this->_obj); Direct use will cause WPS to work, Excel open error, generate garbled $objWriter= \phpexcel_iofactory::createwriter ($this->_obj, ' Excel5 ');//The following usage will solve $objWriter->save (' Php://output '); }
Phpexcel export file, WPS can be opened with Excel garbled solution