我有通过PHPExcel将xls转换为xlsx的代码:
$objPHPexcel = PHPExcel_IOFactory::load('file.xlsx');
$objWriter = PHPExcel_IOFactory::createWriter($objPHPexcel, 'Excel5');
$objWriter->save('new_file.xls');但是当我打开创建的xls文件时,一些单元格是空的。可能的问题是什么?谢谢!
Link to download original xlsx file
发布于 2015-01-23 22:17:05
you should use one of following as formate type.
1)Excel5 -> file format between Excel Version 95 to 2003
2)Excel2003XML -> file format for Excel 2003
3)Excel2007 -> file format for Excel 2007
and add following line at line no.3 in your code before save file statement.
$fileType=PHPExcel_IOFactory::identify("file.xlsx"); //We can get file reader type automatically using
it generate file as per your requirement.发布于 2015-01-23 22:24:24
我确实注意到其中一些单元格包含对外部文件的引用,例如单元格A23包含
='[Форма 1-2 от 15.12 ЯНВАРЬ екат.xls]НТТЗМ'!A77从逻辑上讲,PHPExcel不能简单地访问外部文件(Форма 1-2 от 15.12 ЯНВАРЬ екат.xls)来检索数据;也不能处理对外部文件的引用……该文件甚至可能不存在;如果它存在,则在(递归地)加载公式中可能引用的每个外部文件时会有很大的开销。
虽然您没有指出在新保存的文件中哪些单元格可能为空,但我猜测它们就是包含这些外部文件引用的单元格
https://stackoverflow.com/questions/28110411
复制相似问题