根据上次讲解的导出CSV乱码修复教程,视图模式下导出的CSV文件,均可以正常显示中文,但报表导出EXCEL,依然乱码,修复方法如下:
打开modules\Reports\ReportRun.php,修改:3090行、3099行、3111行、3123行
$worksheet->write(0, $count, iconv("UTF-8", "GBK", $key) , $header); //原来 $worksheet->write(0, $count, $key , $header);
$worksheet->write($key+1, $dcount, iconv("UTF-8", "GBK", $value)); //原来 $worksheet->write($key+1, $dcount, utf8_decode($value));
$worksheet->write($rowcount, $count, iconv("UTF-8", "GBK", $translated_str)); //原来 $worksheet->write($rowcount, $count, $translated_str);
$worksheet->write($key+$rowcount, $dcount, iconv("UTF-8", "GBK", $value)); //原来 $worksheet->write($key+$rowcount, $dcount, utf8_decode($value));