diff --git a/src/Spout/Writer/Internal/XLSX/Worksheet.php b/src/Spout/Writer/Internal/XLSX/Worksheet.php index f778b8c..edde970 100644 --- a/src/Spout/Writer/Internal/XLSX/Worksheet.php +++ b/src/Spout/Writer/Internal/XLSX/Worksheet.php @@ -149,7 +149,7 @@ EOD; if (empty($cellValue)) { $data .= '/>' . PHP_EOL; } else { - if (trim($cellValue, '-0123456789.') == '' /*similar to is_numeric without having PHPs regular quirkiness*/) { + if (trim(ltrim($cellValue, '-'), '0123456789.') == '' /*similar to is_numeric without having PHPs regular quirkiness*/) { $data .= '>' . $cellValue . '' . PHP_EOL; } else { if ($this->shouldUseInlineStrings) { diff --git a/src/Spout/Writer/XLS.php b/src/Spout/Writer/XLS.php index 2278783..ac55d5a 100644 --- a/src/Spout/Writer/XLS.php +++ b/src/Spout/Writer/XLS.php @@ -164,7 +164,7 @@ class XLS extends AbstractWriter $this->home(); foreach ($dataRow as $cell) { - if ($cell != '' && trim($cell, '-0123456789.') == '' /*similar to is_numeric without having PHPs regular quirkiness*/) { + if ($cell != '' && trim(ltrim($cell, '-'), '0123456789.') == '' /*similar to is_numeric without having PHPs regular quirkiness*/) { $wasWriteSuccessful = $wasWriteSuccessful && $this->number($cell); } else {