in a cell a number as text or preceded by an apostrophe."

Mar 19, 2010 at 9:19 PM

Hello! Would like to automatically print a number in a cell which is then treated as text.

"Spend in a cell a number as text or preceded by an apostrophe."

The following attempt failed: (

Thanks for your help!

Christopher and sorry for my englisch

1:::
$objPHPExcel->setActiveSheetIndex(0)->setCellValue("F2", "'$res[9]", PHPExcel_Cell_DataType::TYPE_STRING);

2:::
$objPHPExcel->setActiveSheetIndex(0)->setCellValue("F2", $res[9], PHPExcel_Cell_DataType::TYPE_STRING);

3:::
$objPHPExcel->setActiveSheetIndex(0)->setCellValue("F2", '$res[9]', PHPExcel_Cell_DataType::TYPE_STRING);

Developer
Mar 26, 2010 at 7:11 AM

Instead of this:

$objPHPExcel->setActiveSheetIndex(0)->setCellValue("F2", $res[9], PHPExcel_Cell_DataType::TYPE_STRING);

Use this:

$objPHPExcel->setActiveSheetIndex(0)->setCellValueExplicit("F2", $res[9], PHPExcel_Cell_DataType::TYPE_STRING);