Carriage return

Topics: User Forum
Jan 16, 2010 at 11:14 AM


I'm trying to put a postal address into one cell with carriage returns.  I've tried

$objPHPExcel->getActiveSheet()->setCellValue("N{$myRowNum}", trim($row_Recordset1['address1item1']) . '\n' . trim($row_Recordset1['address1item2']) . '\n' . trim($row_Recordset1['address1item3']));

but I just endup with the string \n in the cell.

I've also tried \r\n with the same result.

Help appreciated.

Jan 16, 2010 at 11:31 AM
Edited Jan 16, 2010 at 11:51 AM

I've added


but this made no difference.

When I right click on the cell in Excel wrap text is ticked for this cell


Jan 16, 2010 at 12:09 PM

My mistake!!

Used single quotes  . '\n' . instead of double quotes . "\n" . so php was printing the literal \n

If you read this post apologies for wasting your time but take comfort in the fact I've wasted even more time by my stupidity.