← All changes
|
libraries/vendor/PhpSpreadsheet/Style/NumberFormat/Formatter.php
+7
-1
3.3.1
→
3.4
View file →
| @@ -173,9 +173,15 @@ | ||
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | // If we have a text value, return it "as is" |
| 176 | 176 | if (!is_numeric($value)) { |
| 177 | - return StringHelper::convertToString($value, true, '', false, $lessFloatPrecision); | |
| 177 | + $temp = StringHelper::convertToString($value, true, '', false, $lessFloatPrecision); | |
| 178 | + if (is_callable($callBack)) { | |
| 179 | + $sections = preg_split(self::SECTION_SPLIT, $format) ?: [$format]; | |
| 180 | + $temp = $callBack($temp, $sections[3] ?? $sections[0]); | |
| 181 | + } | |
| 182 | + | |
| 183 | + return $temp; | |
| 178 | 184 | } |
| 179 | 185 | |
| 180 | 186 | // For 'General' format code, we just pass the value although this is not entirely the way Excel does it, |
| 181 | 187 | // it seems to round numbers to a total of 10 digits. |