PHPOffice / PHPExcel

ARCHIVED
Other
11.46k stars 4.19k forks source link

PHPExcel_Writer_Excel2007 - Uncaught exception 'PHPExcel_Exception' with message 'Invalid cell coordinate' apparently linked to Workbook name #1282

Open BlackPage05 opened 7 years ago

BlackPage05 commented 7 years ago

Hi there,

I'm encountering a problem I cannot seem to be able to resolve upon trying to save a xlsx file based on the attached xlsx source

Here is the stack trace of the error

Fatal error: Uncaught exception 'PHPExcel_Exception' with message 'Invalid cell coordinate 'EAF-CLAN'' in /var/www/html/inc/lib/phpexcel/classes/PHPExcel/Cell.php:590
Stack trace:
#0 /var/www/html/inc/lib/phpexcel/classes/PHPExcel/Cell.php(643): PHPExcel_Cell::coordinateFromString(''EAF-CLAN'')
#1 /var/www/html/inc/lib/phpexcel/classes/PHPExcel/Cell.php(618): PHPExcel_Cell::absoluteCoordinate(''EAF-CLAN'')
#2 /var/www/html/inc/lib/phpexcel/classes/PHPExcel/Writer/Excel2007/Workbook.php(331): PHPExcel_Cell::absoluteReference(''EAF-CLAN'')
#3 /var/www/html/inc/lib/phpexcel/classes/PHPExcel/Writer/Excel2007/Workbook.php(308): PHPExcel_Writer_Excel2007_Workbook->_writeDefinedNameForNamedRange(Object(PHPExcel_Shared_XMLWriter), Object(PHPExcel_NamedRange))
#4 /var/www/html/inc/lib/phpexcel/classes/PHPExcel/Writer/Excel2007/Workbook.php(277): PHPExcel_Writer_Excel2007_Workbook->_writeNamedRanges(Object(PHPExcel_Shared_XMLWriter), Object(PHPExcel))
#5 /var/www/html/inc/lib/phpexcel/classes/PHPExcel/Writer/Excel2007/Workbook.php( in /var/www/html/inc/lib/phpexcel/classes/PHPExcel/Cell.php on line 590

And here is the xlsx source file

bc_fibre_sfr.xlsx

What the required php code does is :

Open the source file Update values in certain cells Save the result as a new xlsx file

The problem is located when trying to save the result file :

$objWriter = new PHPExcel_Writer_Excel2007($objPHPExcel);
print "go"; 
$objWriter->save($C->path() . $Final_File); print "done";

Go is displayed, done is never reached

I've been trying to find the error for weeks but can't seem to grasp it...

Notice that just opening the xlsx file and then trying to save it has the same problem, thus it is not linked to the values that are updated.

Thx in advance

PowerKiKi commented 7 years ago

thus it is not linked to the values that are updated

Then it is linked to the file itself. Try to modify the file, for instance by deleting columns/rows, until it works to identify exactly what cell and what cell content is the problem.

Also next time, please take care of formatting your message. Either use the toolbar or ``` syntax to format code blocks.