diff --git a/Classes/PHPExcel/Cell/DefaultValueBinder.php b/Classes/PHPExcel/Cell/DefaultValueBinder.php index 67a4b5f6..59a9c713 100644 --- a/Classes/PHPExcel/Cell/DefaultValueBinder.php +++ b/Classes/PHPExcel/Cell/DefaultValueBinder.php @@ -76,31 +76,25 @@ class PHPExcel_Cell_DefaultValueBinder implements PHPExcel_Cell_IValueBinder // Match the value against a few data types if (is_null($pValue)) { return PHPExcel_Cell_DataType::TYPE_NULL; - } elseif ($pValue === '') { return PHPExcel_Cell_DataType::TYPE_STRING; - } elseif ($pValue instanceof PHPExcel_RichText) { return PHPExcel_Cell_DataType::TYPE_INLINE; - } elseif ($pValue{0} === '=' && strlen($pValue) > 1) { return PHPExcel_Cell_DataType::TYPE_FORMULA; - } elseif (is_bool($pValue)) { return PHPExcel_Cell_DataType::TYPE_BOOL; - } elseif (is_float($pValue) || is_int($pValue)) { return PHPExcel_Cell_DataType::TYPE_NUMERIC; - } elseif (preg_match('/^\-?([0-9]+\\.?[0-9]*|[0-9]*\\.?[0-9]+)$/', $pValue)) { + if (is_string($pValue) && $pValue{0} === '0' && strlen($pValue) > 1 && $pValue{1} !== '.' ) { + return PHPExcel_Cell_DataType::TYPE_STRING; + } return PHPExcel_Cell_DataType::TYPE_NUMERIC; - } elseif (is_string($pValue) && array_key_exists($pValue, PHPExcel_Cell_DataType::getErrorCodes())) { return PHPExcel_Cell_DataType::TYPE_ERROR; - - } else { - return PHPExcel_Cell_DataType::TYPE_STRING; - } + + return PHPExcel_Cell_DataType::TYPE_STRING; } } diff --git a/changelog.txt b/changelog.txt index bf13da49..2e4c36e6 100644 --- a/changelog.txt +++ b/changelog.txt @@ -35,6 +35,7 @@ Planned for v1.8.1 - Bugfix: (MBaker) - Fix to getStyle() call for cell object - General: (MBaker) - Small performance improvement for autosize columns - General: (frost-nzcr4) Work Item GH-379 - Change the getter/setter for zeroHeight to camel case +- General: (MBaker) Work Item GH-394 - DefaultValueBinder is too much aggressive when converting string to numeric - Feature: (WiktrzGE) Work Item GH-404 - Methods to manage most of the existing options for Chart Axis, Major Grid-lines and Minor Grid-lines - Feature: (frost-nzcr4) Work Item GH-403 - ODS read/write comments in the cell - Feature: (CQD) Work Item GH-389 - Additional Mac CJK codepage definitions