PHPExcel转换器无法正常工作

时间:2018-04-02 02:06:53

标签: php phpexcel

我尝试使用PHPExcel工具将csv转换为xlsx,当我运行脚本时出现错误,转换后我在excel文件中获得了中文字体: Error PHP EXECL 这是我的代码:

<?php
include 'PHPExcel/PHPExcel/IOFactory.php';

$objReader = PHPExcel_IOFactory::createReader('CSV');

// If the files uses a delimiter other than a comma (e.g. a tab), then tell the reader
$objReader->setDelimiter("\t");
// If the files uses an encoding other than UTF-8 or ASCII, then tell the reader
$objReader->setInputEncoding('UTF-16LE');

$objPHPExcel = $objReader->load('myfilebeforeconvert.csv');
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save('afterconvert.xls');
我的错是什么?请告诉我

1 个答案:

答案 0 :(得分:0)

您提供的信息很少,但您可以查看example for help

这也可能有所帮助,check this link