projects
/
Pman.Core
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
82694f5
)
SimpleExcel.php
author
Alan Knowles
<alan@roojs.com>
Mon, 27 Mar 2017 02:59:43 +0000
(10:59 +0800)
committer
Alan Knowles
<alan@roojs.com>
Mon, 27 Mar 2017 02:59:43 +0000
(10:59 +0800)
SimpleExcel.php
patch
|
blob
|
history
diff --git
a/SimpleExcel.php
b/SimpleExcel.php
index
9cf26af
..
484808c
100644
(file)
--- 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..
$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);
||
$dataFormat == 'string' ) {
$worksheet->writeString($start_row+$r, $c, $v, $format);