X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=SimpleExcel.php;h=484808cb05a78d748fa630a59e7f5c0fc35dec88;hb=309360dac02905354483371267f86fc0598c602d;hp=9cf26afe5d86b8d0a219501dd6df00e2c7a8d4d1;hpb=82694f5e6feba42dba58d1394b09c5d2bbccca81;p=Pman.Core diff --git a/SimpleExcel.php b/SimpleExcel.php index 9cf26afe..484808cb 100644 --- a/SimpleExcel.php +++ b/SimpleExcel.php @@ -377,7 +377,13 @@ class Pman_Core_SimpleExcel extends Pman $format = isset($col_cfg['format']) && isset($formats[$col_cfg['format']] ) ? $formats[$col_cfg['format']] : false; // print_R(array($start_row+$r, $c, $v, $format));exit; // handle 0 prefixes.. - if ( (is_numeric($v) && strlen($v) > 1 && substr($v,0,1) == '0' && substr($v,1,1) != '.') + + if (preg_match('/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/', $v)) { + $dataFormat = 'date'; + $format = empty($format) ? 'YYYY-MM-DD' : $format; + } + + if ( (is_numeric($v) && strlen($v) > 1 && substr($v,0,1) == '0' && substr($v,1,1) != '.' ) || $dataFormat == 'string' ) { $worksheet->writeString($start_row+$r, $c, $v, $format);