Fix error with a single byte being removed after the _ spacing character when rendering number formats (#1927)
* Fix error with a single byte being removed after the _ spacing character when rendering number formats
This commit is contained in:
parent
09022256f4
commit
9b67e3f597
|
|
@ -25,6 +25,7 @@ and this project adheres to [Semantic Versioning](https://semver.org).
|
|||
|
||||
### Fixed
|
||||
|
||||
- Fixed issue with _ spacing character in number format mask corrumpting output from toFormattedString() [Issue 1924#](https://github.com/PHPOffice/PhpSpreadsheet/issues/1924) [PR #1927](https://github.com/PHPOffice/PhpSpreadsheet/pull/1927)
|
||||
- Fix for [Issue #1887](https://github.com/PHPOffice/PhpSpreadsheet/issues/1887) - Lose Track of Selected Cells After Save
|
||||
- Fixed issue with Xlsx@listWorksheetInfo not returning any data
|
||||
- Fixed invalid arguments triggering mb_substr() error in LEFT(), MID() and RIGHT() text functions. [Issue #640](https://github.com/PHPOffice/PhpSpreadsheet/issues/640)
|
||||
|
|
|
|||
|
|
@ -848,7 +848,7 @@ class NumberFormat extends Supervisor
|
|||
);
|
||||
|
||||
// Convert any other escaped characters to quoted strings, e.g. (\T to "T")
|
||||
$format = preg_replace('/(\\\(((.)(?!((AM\/PM)|(A\/P))))|([^ ])))(?=(?:[^"]|"[^"]*")*$)/u', '"${2}"', $format);
|
||||
$format = preg_replace('/(\\\(((.)(?!((AM\/PM)|(A\/P))))|([^ ])))(?=(?:[^"]|"[^"]*")*$)/ui', '"${2}"', $format);
|
||||
|
||||
// Get the sections, there can be up to four sections, separated with a semi-colon (but only if not a quoted literal)
|
||||
$sections = preg_split('/(;)(?=(?:[^"]|"[^"]*")*$)/u', $format);
|
||||
|
|
@ -857,7 +857,7 @@ class NumberFormat extends Supervisor
|
|||
|
||||
// In Excel formats, "_" is used to add spacing,
|
||||
// The following character indicates the size of the spacing, which we can't do in HTML, so we just use a standard space
|
||||
$format = preg_replace('/_./', ' ', $format);
|
||||
$format = preg_replace('/_(.)/ui', ' ${1}', $format);
|
||||
|
||||
// Let's begin inspecting the format and converting the value to a formatted string
|
||||
|
||||
|
|
|
|||
|
|
@ -128,6 +128,11 @@ return [
|
|||
12345.678900000001,
|
||||
'#,##0.000\ [$]',
|
||||
],
|
||||
'Spacing Character' => [
|
||||
'826.00 €',
|
||||
826,
|
||||
'#,##0.00 _€',
|
||||
],
|
||||
[
|
||||
'5.68',
|
||||
5.6788999999999996,
|
||||
|
|
@ -294,12 +299,12 @@ return [
|
|||
'[$-1010409]#,##0.00;-#,##0.00',
|
||||
],
|
||||
[
|
||||
' $ 23.06 ',
|
||||
' ($ 23.06 )',
|
||||
23.0597,
|
||||
'_("$"* #,##0.00_);_("$"* \(#,##0.00\);_("$"* "-"??_);_(@_)',
|
||||
],
|
||||
[
|
||||
' € 13.03 ',
|
||||
' (€ 13.03 )',
|
||||
13.0316,
|
||||
'_("€"* #,##0.00_);_("€"* \(#,##0.00\);_("€"* "-"??_);_(@_)',
|
||||
],
|
||||
|
|
|
|||
Loading…
Reference in New Issue