"Column string index can not be empty" on merging cell

Topics: User Forum
Apr 26, 2011 at 11:58 PM

here is my code that produce the error,

	include_once("PHPExcel.php");
	    $objPHPExcel = new PHPExcel();                      
	    $objPHPExcel->setActiveSheetIndex(0);
	    $sheet = $objPHPExcel->getActiveSheet();
	    
		$sheet->setCellValue('A1','A pretty long sentence that deserves to be in a merged cell');
		$sheet->mergeCells('A1:C1');
		$sheet->setCellValue('A3','A pretty long sentence that deserves to be in a merged cell');
		$sheet->mergeCells('A3:C3');
		$sheet->setCellValue('B5','A pretty long sentence that deserves to be in a merged cell');
		$sheet->mergeCells('B5:E5');
		$objWriter = new PHPExcel_Writer_Excel5($objPHPExcel);
	    $objWriter->save("simple_merge".".xls");
	    
	    echo "<a href='simple_merge".".xls'><u>simple_merge.xls</u></a> created <br>";

here is the error:
Fatal error: Uncaught exception 'Exception' with message 'Column string index can not be empty.' in D:\AppServ\www\straight\PHPExcel\Cell.php:689 Stack trace: #0 D:\AppServ\www\straight\PHPExcel\Writer\Excel5\Worksheet.php(1510): PHPExcel_Cell::columnIndexFromString(4) #1 D:\AppServ\www\straight\PHPExcel\Writer\Excel5\Worksheet.php(470): PHPExcel_Writer_Excel5_Worksheet->_writeMergedCells() #2 D:\AppServ\www\straight\PHPExcel\Writer\Excel5.php(171): PHPExcel_Writer_Excel5_Worksheet->close() #3 D:\AppServ\www\straight\simple_merge.php(14): PHPExcel_Writer_Excel5->save('simple_merge.xl...') #4 {main} thrown in D:\AppServ\www\straight\PHPExcel\Cell.php on line 689

can anyone help me..

thanks

Coordinator
Apr 29, 2011 at 4:38 PM

Unable to replicate problem. Can you provide any further details such as version of PHPExcel, version of PHP.

Apr 29, 2011 at 11:12 PM

hi mark, thanks for responding

so.. the code above didn't show any error?

ok, I'm using windows XP, PHP Version 6.0.0-dev, PHPExcel version 1.7.6, 2011-02-27 and Apache 2.0

Coordinator
Apr 29, 2011 at 11:53 PM

Can you try using a production release of PHP.
The latest production release is 5.3.6, but PHPExcel should work with any release from the 5.2 or 5.3 branches.

As far as I'm aware, 6.0.0-dev isn't even an official development branch any more: it was formally discontinued in March last year, and the branch was deleted.
The official development branch is currently 5.4.

6.0.0-dev was never even an alpha release, so it could not be considered stable.
PHPExcel is tested against new releases of PHP as they are released to beta, but not in advance of that.
While a few early distributions appeared with the 6.0.0 development code before it was discontinued (such as AppServe 2.6.0), I wouldn't advocate using them for anything,
and certainly won't test PHPExcel against a release of PHP that no longer exists, and never will exist.

May 10, 2011 at 4:08 AM

thx mark, the problem solved as i change the PHP version to PHP 5.X