Fix number detection

This commit is contained in:
Chris Graham 2015-03-30 22:17:44 +01:00
parent bf0251b433
commit 3b334dce1f
2 changed files with 2 additions and 2 deletions

View File

@ -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 .= '><v>' . $cellValue . '</v></c>' . PHP_EOL;
} else {
if ($this->shouldUseInlineStrings) {

View File

@ -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
{