String "=-- Gif" crash - Initial error

Topics: Developer Forum, Project Management Forum, User Forum
Jul 13, 2010 at 1:26 PM
I try to write in excel with this line $objPHPExcel->setActiveSheetIndex(0)->setCellValueByColumnAndRow( 1, 1, '=-- Gif' ); but this line crash because of string "=-- Gif" any idea why or what to do to fix that ? tnx for help :)
Jul 13, 2010 at 9:42 PM

It's likely that PHPExcel is considering your value is a formula because it begins with an = sign, and is trying to calculate a value.

It would actually constitute a valid formula if you had a named range called "Gif"; but otherwise would return a #NAME! error


Unsure at present how to fix, but you might try

$objPHPExcel->setActiveSheetIndex(0)->setCellValueExplicitByColumnAndRow(1,1, '=-- Gif', PHPExcel_Cell_DataType::TYPE_STRING);
Jul 14, 2010 at 11:25 AM
This not fix my problem :)
Jul 14, 2010 at 9:56 PM
Well usually in Excel if you put an apostrophe before an equal sign, it will display it as plaintext.. Not sure if this would work for you though. $objPHPExcel->setActiveSheetIndex(0)->setCellValueByColumnAndRow( 1, 1, "'=-- Gif" );