Topics: Developer Forum, User Forum
May 8, 2012 at 3:12 PM
Edited May 8, 2012 at 3:15 PM


I have to write a phone number in a file. xls (eg: 070123456).

here is the code I use:


$cli = 070123456;

$objPHPExcel->getActiveSheet()->setCellValue('B2', "$cli");

There is one problem: the cell is formatted correctly (Text), but inside the cell reaches the data: 70123456

You have ideas or suggestions?

Thank you all


May 9, 2012 at 7:24 AM

I solved it this way:

$objPHPExcel->getActiveSheet()->setCellValueExplicit('B2', "$cli", PHPExcel_Cell_DataType::TYPE_STRING);


May 9, 2012 at 9:09 PM

See this thread for a more detailed explanation of the format codes that you can use in this case