Fix to number format masking for scientific notation
This commit is contained in:
parent
8f7db244de
commit
a0859fd7d0
|
@ -673,7 +673,10 @@ class PHPExcel_Style_NumberFormat extends PHPExcel_Style_Supervisor implements P
|
|||
);
|
||||
$value = preg_replace($number_regex, $value, $format);
|
||||
} else {
|
||||
if (preg_match('/0([^\d\.]+)0/', $format, $matches)) {
|
||||
if (preg_match('/0E[+-]0/i', $format)) {
|
||||
// Scientific format
|
||||
$value = sprintf('%5.2E', $value);
|
||||
} elseif (preg_match('/0([^\d\.]+)0/', $format)) {
|
||||
$value = self::_complexNumberFormatMask($value, $format);
|
||||
} else {
|
||||
$sprintf_pattern = "%0$minWidth." . strlen($right) . "f";
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
123.456, '"$#,##0.00"', "$123.46"
|
||||
-123.456, '"$#,##0.00"', "$-123.46"
|
||||
123.456, '"#,##0.00"', "123.46"
|
||||
123.456, '"#,##0"', "123"
|
||||
123.456, "00000", "00123"
|
||||
123456.789, '"$#,##0.00"', '"$123,456.79"'
|
||||
123456.789, '"#,##0.00"', '"123,456.79"'
|
||||
123456.789, "0.00E+00", "1.23E05"
|
||||
-123456.789, "0.00E+00", "-1.23E05"
|
||||
0.000012345, "0.00E+00", "1.23E-05"
|
||||
"19-Dec-1960", "yyyy-mm-dd", "1960-12-19"
|
||||
"1-Jan-2012", "yyyy-mm-dd", "2012-01-01"
|
||||
1.75, "# ?/?", "1 3/4"
|
||||
|
|
Loading…
Reference in New Issue