Fix to complex number format signing when mask has a decimal

This commit is contained in:
MarkBaker 2015-01-23 16:09:36 +00:00
parent d778b41524
commit fb18b7b598
2 changed files with 4 additions and 2 deletions

View File

@ -505,8 +505,8 @@ class PHPExcel_Style_NumberFormat extends PHPExcel_Style_Supervisor implements P
$numbers = explode('.', $number . '.0'); $numbers = explode('.', $number . '.0');
$masks = explode('.', $mask . '.0'); $masks = explode('.', $mask . '.0');
$result1 = self::_complexNumberFormatMask($numbers[0], $masks[0], 1); $result1 = self::_complexNumberFormatMask($numbers[0], $masks[0], 1);
$result2 = strrev(self::_complexNumberFormatMask(strrev($numbers[1]), strrev($masks[1])), 1); $result2 = strrev(self::_complexNumberFormatMask(strrev($numbers[1]), strrev($masks[1]), 1));
return $result1 . '.' . $result2; return (($sign) ? '-' : '') . $result1 . '.' . $result2;
} }
$r = preg_match_all('/0+/', $mask, $result, PREG_OFFSET_CAPTURE); $r = preg_match_all('/0+/', $mask, $result, PREG_OFFSET_CAPTURE);

View File

@ -33,3 +33,5 @@
123456789, '0 (+00) 0000 00 00 00', "0 (+00) 0123 45 67 89" 123456789, '0 (+00) 0000 00 00 00', "0 (+00) 0123 45 67 89"
123456789, '0000:00:00', "12345:67:89" 123456789, '0000:00:00', "12345:67:89"
-123456789, '0000:00:00', "-12345:67:89" -123456789, '0000:00:00', "-12345:67:89"
1234567.89, '0000:00.00', "12345:67.89"
-1234567.89,'0000:00.00', "-12345:67.89"