PHPExcel number formats for dates -


i have spreadsheet when open in excel cells in question show formatting date mm-dd-yyyy.

when run through php excel reader (xlsx file) not recognize date.

i opened file in ms open xml sdk , shows in styles numfmts

numfmtid="102" formatcode="mm-dd-yyyy" numfmtid="104" formatcode="mm-dd-yyyy" numfmtid="106" formatcode="mm-dd-yyyy" numfmtid="108" formatcode="mm-dd-yyyy" numfmtid="110" formatcode="mm-dd-yyyy" numfmtid="112" formatcode="mm-dd-yyyy" numfmtid="114" formatcode="mm-dd-yyyy" numfmtid="116" formatcode="mm-dd-yyyy" numfmtid="118" formatcode="mm-dd-yyyy" 

it convert date after added

self::$_builtinformats[102]             = 'mm-dd-yyyy'; self::$_builtinformats[104]             = 'mm-dd-yyyy'; self::$_builtinformats[106]             = 'mm-dd-yyyy'; self::$_builtinformats[108]             = 'mm-dd-yyyy'; self::$_builtinformats[110]             = 'mm-dd-yyyy'; self::$_builtinformats[112]             = 'mm-dd-yyyy'; self::$_builtinformats[114]             = 'mm-dd-yyyy'; self::$_builtinformats[116]             = 'mm-dd-yyyy'; self::$_builtinformats[118]             = 'mm-dd-yyyy'; 

to numberformat.php.

is supposed case

ms excel uses format codes 0 163 "built-in" formats, there lot of unused entries in set, , nothing officially defined format codes 102 118. codes listed built-in in phpexcel phpexcel_style_numberformat class main built-ins, ignoring few special localised formats chinese/korean/thai/japanese localised.

however, restriction doesn't prevent lot of naughty homebrew xlsx writers using "reserved" id values aren't defined in iso specification.

typically, these values should defined in /xl/styles.xml file in block looking like:

<numfmts count="2">     <numfmt formatcode="mm-dd-yyyy" numfmtid="102"/>     <numfmt formatcode="mm-dd-yyyy" numfmtid="104"/>     ... </numfmts> 

while latest production release of phpexcel adheres iso standard, , ignores values below 164 unless explicitly defined in formal specification (ie uses values in built-in list), change has been made in 1.8 branch "tolerate" misuse of standard, , code read user-defined number format values below 164 unless over-ride value defined in standard.


Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -