← All changes
|
vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/NumberFormat.php
+19
-1
3.1.3
→
3.9.4
View file →
| @@ -48,8 +48,10 @@ | ||
| 48 | 48 | const FORMAT_CURRENCY_USD_SIMPLE = '"$"#,##0.00_-'; |
| 49 | 49 | const FORMAT_CURRENCY_USD = '$#,##0_-'; |
| 50 | 50 | const FORMAT_CURRENCY_EUR_SIMPLE = '#,##0.00_-"€"'; |
| 51 | 51 | const FORMAT_CURRENCY_EUR = '#,##0_-"€"'; |
| 52 | + const FORMAT_ACCOUNTING_USD = '_("$"* #,##0.00_);_("$"* \(#,##0.00\);_("$"* "-"??_);_(@_)'; | |
| 53 | + const FORMAT_ACCOUNTING_EUR = '_("€"* #,##0.00_);_("€"* \(#,##0.00\);_("€"* "-"??_);_(@_)'; | |
| 52 | 54 | |
| 53 | 55 | /** |
| 54 | 56 | * Excel built-in number formats. |
| 55 | 57 | * |
| @@ -307,8 +309,24 @@ | ||
| 307 | 309 | self::$builtInFormats[68] = 't0.00%'; |
| 308 | 310 | self::$builtInFormats[69] = 't# ?/?'; |
| 309 | 311 | self::$builtInFormats[70] = 't# ??/??'; |
| 310 | 312 | |
| 313 | + // JPN | |
| 314 | + self::$builtInFormats[28] = '[$-411]ggge"年"m"月"d"日"'; | |
| 315 | + self::$builtInFormats[29] = '[$-411]ggge"年"m"月"d"日"'; | |
| 316 | + self::$builtInFormats[31] = 'yyyy"年"m"月"d"日"'; | |
| 317 | + self::$builtInFormats[32] = 'h"時"mm"分"'; | |
| 318 | + self::$builtInFormats[33] = 'h"時"mm"分"ss"秒"'; | |
| 319 | + self::$builtInFormats[34] = 'yyyy"年"m"月"'; | |
| 320 | + self::$builtInFormats[35] = 'm"月"d"日"'; | |
| 321 | + self::$builtInFormats[51] = '[$-411]ggge"年"m"月"d"日"'; | |
| 322 | + self::$builtInFormats[52] = 'yyyy"年"m"月"'; | |
| 323 | + self::$builtInFormats[53] = 'm"月"d"日"'; | |
| 324 | + self::$builtInFormats[54] = '[$-411]ggge"年"m"月"d"日"'; | |
| 325 | + self::$builtInFormats[55] = 'yyyy"年"m"月"'; | |
| 326 | + self::$builtInFormats[56] = 'm"月"d"日"'; | |
| 327 | + self::$builtInFormats[58] = '[$-411]ggge"年"m"月"d"日"'; | |
| 328 | + | |
| 311 | 329 | // Flip array (for faster lookups) |
| 312 | 330 | self::$flippedBuiltInFormats = array_flip(self::$builtInFormats); |
| 313 | 331 | } |
| 314 | 332 | } |
| @@ -595,9 +613,9 @@ | ||
| 595 | 613 | return $value; |
| 596 | 614 | } |
| 597 | 615 | |
| 598 | 616 | // Convert any other escaped characters to quoted strings, e.g. (\T to "T") |
| 599 | - $format = preg_replace('/(\\\([^ ]))(?=(?:[^"]|"[^"]*")*$)/u', '"${2}"', $format); | |
| 617 | + $format = preg_replace('/(\\\(((.)(?!((AM\/PM)|(A\/P))))|([^ ])))(?=(?:[^"]|"[^"]*")*$)/u', '"${2}"', $format); | |
| 600 | 618 | |
| 601 | 619 | // Get the sections, there can be up to four sections, separated with a semi-colon (but only if not a quoted literal) |
| 602 | 620 | $sections = preg_split('/(;)(?=(?:[^"]|"[^"]*")*$)/u', $format); |
| 603 | 621 | |