From ed641a7e5c488ce8350f882c86057290ac2a2926 Mon Sep 17 00:00:00 2001 From: Pan Chengxian Date: Fri, 20 Apr 2018 11:29:34 +0800 Subject: [PATCH 1/2] fix issue while reading col with digital value as string , the dropping the leading zeros --- SpreadsheetReader_XLSX.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SpreadsheetReader_XLSX.php b/SpreadsheetReader_XLSX.php index 9cf8d12..d9609f3 100644 --- a/SpreadsheetReader_XLSX.php +++ b/SpreadsheetReader_XLSX.php @@ -929,7 +929,7 @@ private function FormatValue($Value, $Index) public function GeneralFormat($Value) { // Numeric format - if (is_numeric($Value)) + if (is_numeric($Value) && preg_match('/^(?:-)?([1-9]|(0\.))/', $Value)) { $Value = (float)$Value; } From 968e37b109b7eb43e092b944be2b5f8e52f4e6e3 Mon Sep 17 00:00:00 2001 From: Pan Chengxian Date: Fri, 20 Apr 2018 11:29:34 +0800 Subject: [PATCH 2/2] fix issue treating all numeric string as float (leading zero dropped) --- SpreadsheetReader_XLSX.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SpreadsheetReader_XLSX.php b/SpreadsheetReader_XLSX.php index 9cf8d12..d9609f3 100644 --- a/SpreadsheetReader_XLSX.php +++ b/SpreadsheetReader_XLSX.php @@ -929,7 +929,7 @@ private function FormatValue($Value, $Index) public function GeneralFormat($Value) { // Numeric format - if (is_numeric($Value)) + if (is_numeric($Value) && preg_match('/^(?:-)?([1-9]|(0\.))/', $Value)) { $Value = (float)$Value; }