Dash ('-') like cell value

Topics: Developer Forum, Project Management Forum, User Forum
Nov 4, 2009 at 1:38 PM

Hi all.

I having a problem when I try to put a dash ('-') like cell value. Here you the pice of my source code where I do that.

if ( _empty($value) ) {
   $objPHPExcel->getActiveSheet()->setCellValue($row, '-');
} else {

where $row is a value like 'A1'.

When I open the Excel file generated I found, in the cell, a zero ('0') and not the dash I expected.

I have tried also this solution:

if ( _empty($value) ) {
   $objPHPExcel->getActiveSheet()->setCellValue($row, "-");
} else {

but obtain the same result above.

Someone had the same problem or have solved it?



Nov 4, 2009 at 1:47 PM


$objPHPExcel->getActiveSheet()->setCellValueExplicit($row, '-',PHPExcel_Cell_DataType::TYPE_STRING);


Nov 4, 2009 at 1:55 PM

Thank's Mark.

This work for me. GREAT!

And thank you for your job. It's very important. :)


Nov 5, 2009 at 12:44 AM

MarkBaker's solutions is good, but this is still a bug in PHPExcel. The single hyphen is seen as a minus sign which is wrong.

Fixing this here: