Fatal error: Uncaught exception 'Exception' with message 'Invalid cell coordinate 1'

Topics: Developer Forum, User Forum
Feb 8, 2011 at 8:01 AM

Guys,

I get this strange error when I execute the save statement..

F11 is a merged cell

This is the trace error:

 08:49:27 Load from Excel2007 file
08:49:34 Write to Excel2007 format
<br />
<b>Fatal error</b>:  Uncaught exception 'Exception' with message 'Invalid cell coordinate 1' in C:\xammp\xampp\htdocs\phpe\Classes\PHPExcel\Cell.php:501
Stack trace:
#0 C:\xammp\xampp\htdocs\phpe\Classes\PHPExcel\Cell.php(516): PHPExcel_Cell::coordinateFromString('1')
#1 C:\xammp\xampp\htdocs\phpe\Classes\PHPExcel\Writer\Excel2007\Workbook.php(433): PHPExcel_Cell::absoluteCoordinate('1')
#2 C:\xammp\xampp\htdocs\phpe\Classes\PHPExcel\Writer\Excel2007\Workbook.php(283): PHPExcel_Writer_Excel2007_Workbook-&gt;_writeDefinedNameForPrintArea(Object(PHPExcel_Shared_XMLWriter), Object(PHPExcel_Worksheet), 0)
#3 C:\xammp\xampp\htdocs\phpe\Classes\PHPExcel\Writer\Excel2007\Workbook.php(82): PHPExcel_Writer_Excel2007_Workbook-&gt;_writeDefinedNames(Object(PHPExcel_Shared_XMLWriter), Object(PHPExcel))
#4 C:\xammp\xampp\htdocs\phpe\Classes\PHPExcel\Writer\Excel2007.php(260): PHPExcel_Writer_Excel2007_Workbook-&gt;writeWorkbook(Object(PHPExcel))
#5 C:\xammp\xampp\htdocs\phpe\Tests\test.php(48): PHPExcel_Writer_Excel2007-&gt;save('test.xlsx')
#6 {main}
   in <b>C:\xammp\xampp\htdocs\phpe\Classes\PHPExcel\Cell.php</b> on line <b>501</b><br />

This is the code:

/** PHPExcel_IOFactory */
require_once '../Classes/PHPExcel/IOFactory.php';
$file="oldtest.xlsx";

if (!file_exists($file)) {	die();}

echo date('H:i:s') . " Load from Excel2007 file\n";
/**  Create a new Reader of the type defined in $inputFileType  **/
$objPHPExcel = PHPExcel_IOFactory::load($file);

$objPHPExcel->setActiveSheetIndex(0);
$objPHPExcel->getActiveSheet()->setCellValue("F11", "HelloWorld");
echo date('H:i:s') . " Write to Excel2007 format\n";
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save('test.xlsx');

Feb 8, 2011 at 8:13 AM
This has exacly the same problem...
$objPHPExcel = PHPExcel_IOFactory::load($file);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save('test.xlsx');
Coordinator
Feb 8, 2011 at 8:48 AM

This has already been raised as an issue: Work Item 15121

Feb 8, 2011 at 9:03 AM

Mark,

Is there in meanwhile some kind of a workarround for us ?

Coordinator
Feb 8, 2011 at 12:56 PM

This issue is now fixed in the latest SVN code