Fix Xlsx Writer's handling of decimal commas (#1282)
Perform the comma -> period substitution in Xlsx Writer writeCell() before checking if the decimal value has a period in it. The previous behavior led to decimals of the form "1,1" to become "1.1.0".
This commit is contained in:
parent
9fab8900ef
commit
ab4c6602cf
|
@ -1137,13 +1137,13 @@ class Worksheet extends WriterPart
|
|||
case 'n': // Numeric
|
||||
//force a decimal to be written if the type is float
|
||||
if (is_float($cellValue)) {
|
||||
$cellValue = (string) $cellValue;
|
||||
// force point as decimal separator in case current locale uses comma
|
||||
$cellValue = str_replace(',', '.', (string) $cellValue);
|
||||
if (strpos($cellValue, '.') === false) {
|
||||
$cellValue = $cellValue . '.0';
|
||||
}
|
||||
}
|
||||
// force point as decimal separator in case current locale uses comma
|
||||
$objWriter->writeElement('v', str_replace(',', '.', $cellValue));
|
||||
$objWriter->writeElement('v', $cellValue);
|
||||
|
||||
break;
|
||||
case 'b': // Boolean
|
||||
|
|
Loading…
Reference in New Issue