String Data Type

Topics: User Forum
Dec 7, 2011 at 7:03 PM

For some reason when I specify PHPExcel_Cell_DataType::TYPE_STRING numbers are still displayed in Excel as numbers.  I have order numbers that are rather long and Excel is converting them to exponential format.  My code is $this->workbook->getActiveSheet()->getCell($cell)->setDataType(PHPExcel_Cell_DataType::TYPE_STRING);  Is this a bug or am I missing something?

Dec 7, 2011 at 7:36 PM

Try this instead...

$format_string = array(
	'numberformat' => array(
		'code' => '@',
	),
);

$this->workbook->getActiveSheet()->getStyle($cell)->applyFromArray($format_string);

Dec 21, 2011 at 3:18 PM

Sadly, that didn't work.