mirror of
https://github.com/retailcrm/PHPExcel.git
synced 2024-11-22 13:26:07 +03:00
Handle some discrepancies between the ECMA standard and actual internal number formats used by MS Excel
This commit is contained in:
parent
87ba429020
commit
941ab7d739
@ -243,6 +243,28 @@ class PHPExcel_Style_NumberFormat extends PHPExcel_Style_Supervisor implements P
|
|||||||
*/
|
*/
|
||||||
private static function fillBuiltInFormatCodes()
|
private static function fillBuiltInFormatCodes()
|
||||||
{
|
{
|
||||||
|
// [MS-OI29500: Microsoft Office Implementation Information for ISO/IEC-29500 Standard Compliance]
|
||||||
|
// 18.8.30. numFmt (Number Format)
|
||||||
|
//
|
||||||
|
// The ECMA standard defines built-in format IDs
|
||||||
|
// 14: "mm-dd-yy"
|
||||||
|
// 22: "m/d/yy h:mm"
|
||||||
|
// 37: "#,##0 ;(#,##0)"
|
||||||
|
// 38: "#,##0 ;[Red](#,##0)"
|
||||||
|
// 39: "#,##0.00;(#,##0.00)"
|
||||||
|
// 40: "#,##0.00;[Red](#,##0.00)"
|
||||||
|
// 47: "mmss.0"
|
||||||
|
// KOR fmt 55: "yyyy-mm-dd"
|
||||||
|
// Excel defines built-in format IDs
|
||||||
|
// 14: "m/d/yyyy"
|
||||||
|
// 22: "m/d/yyyy h:mm"
|
||||||
|
// 37: "#,##0_);(#,##0)"
|
||||||
|
// 38: "#,##0_);[Red](#,##0)"
|
||||||
|
// 39: "#,##0.00_);(#,##0.00)"
|
||||||
|
// 40: "#,##0.00_);[Red](#,##0.00)"
|
||||||
|
// 47: "mm:ss.0"
|
||||||
|
// KOR fmt 55: "yyyy/mm/dd"
|
||||||
|
|
||||||
// Built-in format codes
|
// Built-in format codes
|
||||||
if (is_null(self::$builtInFormats)) {
|
if (is_null(self::$builtInFormats)) {
|
||||||
self::$builtInFormats = array();
|
self::$builtInFormats = array();
|
||||||
@ -259,7 +281,7 @@ class PHPExcel_Style_NumberFormat extends PHPExcel_Style_Supervisor implements P
|
|||||||
self::$builtInFormats[11] = '0.00E+00';
|
self::$builtInFormats[11] = '0.00E+00';
|
||||||
self::$builtInFormats[12] = '# ?/?';
|
self::$builtInFormats[12] = '# ?/?';
|
||||||
self::$builtInFormats[13] = '# ??/??';
|
self::$builtInFormats[13] = '# ??/??';
|
||||||
self::$builtInFormats[14] = 'mm-dd-yy';
|
self::$builtInFormats[14] = 'm/d/yyyy'; // Despite ECMA 'mm-dd-yy';
|
||||||
self::$builtInFormats[15] = 'd-mmm-yy';
|
self::$builtInFormats[15] = 'd-mmm-yy';
|
||||||
self::$builtInFormats[16] = 'd-mmm';
|
self::$builtInFormats[16] = 'd-mmm';
|
||||||
self::$builtInFormats[17] = 'mmm-yy';
|
self::$builtInFormats[17] = 'mmm-yy';
|
||||||
@ -267,17 +289,17 @@ class PHPExcel_Style_NumberFormat extends PHPExcel_Style_Supervisor implements P
|
|||||||
self::$builtInFormats[19] = 'h:mm:ss AM/PM';
|
self::$builtInFormats[19] = 'h:mm:ss AM/PM';
|
||||||
self::$builtInFormats[20] = 'h:mm';
|
self::$builtInFormats[20] = 'h:mm';
|
||||||
self::$builtInFormats[21] = 'h:mm:ss';
|
self::$builtInFormats[21] = 'h:mm:ss';
|
||||||
self::$builtInFormats[22] = 'm/d/yy h:mm';
|
self::$builtInFormats[22] = 'm/d/yyyy h:mm'; // Despite ECMA 'm/d/yy h:mm';
|
||||||
|
|
||||||
self::$builtInFormats[37] = '#,##0 ;(#,##0)';
|
self::$builtInFormats[37] = '#,##0_);(#,##0)'; // Despite ECMA '#,##0 ;(#,##0)';
|
||||||
self::$builtInFormats[38] = '#,##0 ;[Red](#,##0)';
|
self::$builtInFormats[38] = '#,##0_);[Red](#,##0)'; // Despite ECMA '#,##0 ;[Red](#,##0)';
|
||||||
self::$builtInFormats[39] = '#,##0.00;(#,##0.00)';
|
self::$builtInFormats[39] = '#,##0.00_);(#,##0.00)'; // Despite ECMA '#,##0.00;(#,##0.00)';
|
||||||
self::$builtInFormats[40] = '#,##0.00;[Red](#,##0.00)';
|
self::$builtInFormats[40] = '#,##0.00_);[Red](#,##0.00)'; // Despite ECMA '#,##0.00;[Red](#,##0.00)';
|
||||||
|
|
||||||
self::$builtInFormats[44] = '_("$"* #,##0.00_);_("$"* \(#,##0.00\);_("$"* "-"??_);_(@_)';
|
self::$builtInFormats[44] = '_("$"* #,##0.00_);_("$"* \(#,##0.00\);_("$"* "-"??_);_(@_)';
|
||||||
self::$builtInFormats[45] = 'mm:ss';
|
self::$builtInFormats[45] = 'mm:ss';
|
||||||
self::$builtInFormats[46] = '[h]:mm:ss';
|
self::$builtInFormats[46] = '[h]:mm:ss';
|
||||||
self::$builtInFormats[47] = 'mmss.0';
|
self::$builtInFormats[47] = 'mm:ss.0'; // Despite ECMA 'mmss.0';
|
||||||
self::$builtInFormats[48] = '##0.0E+0';
|
self::$builtInFormats[48] = '##0.0E+0';
|
||||||
self::$builtInFormats[49] = '@';
|
self::$builtInFormats[49] = '@';
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user