Formatting issue - what am I missing?

Topics: User Forum
Mar 12, 2014 at 3:33 PM
Edited Mar 12, 2014 at 3:35 PM
When I call setFormatCode() starting from a Sheet object, the formatting works as expected. However, when I call it starting from a Cell object, the format code is applied to every cell.
$sheet = $objPHPExcel->setActiveSheetIndex(0);
$cell = $sheet->getCellByColumnAndRow($start_col + $c, $start_row + $r);
$ts = date_ts($value); // converts text date such as '2014-03-01' to unix timestamp
// this does not work...

// this works...
$sheet->getStyleByColumnAndRow($start_col + $c, $start_row + $r)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_DATE_YYYYMMDD);