PHPOffice / PHPExcel

ARCHIVED
Other
11.46k stars 4.19k forks source link

On opening an Excel5 file receiving 'Cell coordinate can not be zero-length string' #153

Open AndHam89 opened 11 years ago

AndHam89 commented 11 years ago

Trying to open the Excel file 'test_excel.xls' I receive the following stack trace. It seems that the graphics within the file might cause a problem. The Excel file 'test_excel.xls' can be provided but I don't know how to attach it to this issue.

PHP Fatal error:  Uncaught exception 'PHPExcel_Exception' with message 'Cell coordinate can not be zero-length string' in /data/development/openDCIM/PHPExcel/Classes/PHPExcel/Cell.php:536
Stack trace:
#0 /data/development/openDCIM/PHPExcel/Classes/PHPExcel/Reader/Excel5.php(956): PHPExcel_Cell::coordinateFromString(NULL)
#1 /data/development/openDCIM/code/extras/test_read_excel.php(14): PHPExcel_Reader_Excel5->load('/var/tmp/test_e...')
#2 /data/development/openDCIM/code/extras/test_read_excel.php(19): import_excel('/var/tmp/test_e...')
#3 {main}
  thrown in /data/development/openDCIM/PHPExcel/Classes/PHPExcel/Cell.php on line 536

The code which produces the error is as follows.


set_include_path(get_include_path() . PATH_SEPARATOR .
         __DIR__.'/../../PHPExcel/Classes');
require_once('PHPExcel/IOFactory.php');

function import_excel($file) {
  if (!file_exists($file)) {
    echo 'Could not open import file for reading';
    return false;
  }
  $objReader = PHPExcel_IOFactory::createReaderForFile($file);
  $xlsData = $objReader->load($file);
  return $lines;
}

$xls_content = import_excel('/var/tmp/test_excel.xls');
MarkBaker commented 11 years ago

Unfortunately, github doesn't provide any mechanism for uploading files to issues, so we have the old file attachments link on codeplex where you can upload files - http://phpexcel.codeplex.com/workitem/10749?ProjectName=phpexcel

AndHam89 commented 11 years ago

Test file is uploaded to CodePlex with the title Test file for issue #153

description Attached is the test file 'test_excel.xls' for the issue #153 reported with the title

On opening an Excel5 file receiving 'Cell coordinate can not be zero-length string'

tesmojones commented 11 years ago

I have same problem. My file is Excel5 too..