PHPExcell单元格坐标不能为零长度字符串


PHPExcell Cell coordinate can not be zero-length string

我通过Zend框架使用PHPExcel,并希望将整个Excel文件读取到数据数组中。我从这个页面下载了最终版本。

我使用的代码如下:
static function Read_Excel($inputFileName)
{
    $inputFileType = PHPExcel_IOFactory::identify($inputFileName);
    $objReader = PHPExcel_IOFactory::createReader($inputFileType);      
    $objReader->setReadDataOnly(true);
    $objPHPExcel = $objReader->load($inputFileName);    
    $objWorksheet = $objPHPExcel->setActiveSheetIndex(0);
    $highestRow = $objWorksheet->getHighestRow();
    $highestColumn = $objWorksheet->getHighestColumn();
    $highestColumnIndex = PHPExcel_Cell::columnIndexFromString($highestColumn);
    if($highestRow <=0 || $highestColumnIndex<=0)
        return false;
    $arr_data = array();
    for ($row = 1; $row <= $highestRow; $row ++) {
        for ($col = 0; $col <= $highestColumnIndex; $col ++) {
            $value = $objWorksheet->getCellByColumnAndRow($col, $row)->getValue();
            if (is_array($arr_data))
                $arr_data[$row - 1][$col] = $value;
        }
    }
    return $arr_data;
}

我得到这个错误:

 Message: Cell coordinate can not be zero-length string
Stack trace:
#0 C:'xampp'htdocs'wimax.shabdiznet.com'library'PHPExcel'Reader'Excel2007.php(935): PHPExcel_Cell::coordinateFromString('')
#1 C:'xampp'htdocs'wimax.shabdiznet.com'application'models'Functions.php(30): PHPExcel_Reader_Excel2007->load('C:'xampp'tmp'ph...')
#2 C:'xampp'htdocs'wimax.shabdiznet.com'application'controllers'ImportController.php(56): Application_Model_Functions::Read_Excel('C:'xampp'tmp'ph...')
#3 C:'xampp'htdocs'wimax.shabdiznet.com'library'Zend'Controller'Action.php(516): ImportController->indexAction()
#4 C:'xampp'htdocs'wimax.shabdiznet.com'library'Zend'Controller'Dispatcher'Standard.php(295): Zend_Controller_Action->dispatch('indexAction')
#5 C:'xampp'htdocs'wimax.shabdiznet.com'library'Zend'Controller'Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#6 C:'xampp'htdocs'wimax.shabdiznet.com'library'Zend'Application'Bootstrap'Bootstrap.php(97): Zend_Controller_Front->dispatch()
#7 C:'xampp'htdocs'wimax.shabdiznet.com'library'Zend'Application.php(366): Zend_Application_Bootstrap_Bootstrap->run()
#8 C:'xampp'htdocs'wimax.shabdiznet.com'public'index.php(25): Zend_Application->run()
#9 {main}  

我找了很多,但什么也没找到!如何解决这个问题?

您定义的单元格太短,可以添加一些单元格这样的:

$细胞=阵列(A1, B1, C1, D1, E1, F1, G1, H1, I1, j - 1, K1, L1, M1,"N1","O1群"、"P1",Q1, R1, S1, T1,‘U1’,‘V1’,‘W1’,X1, Y1, Z1);