From b245b2842afb12cc221814818b96c922d8036de1 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Tue, 7 Sep 2010 11:40:06 +0000 Subject: [PATCH] Workitem 7895 - Excel5 : Formula : String constant containing double quotation mark git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@60517 2327b42d-5241-43d6-9e2a-de5ac946f064 --- Classes/PHPExcel/Writer/Excel5/Parser.php | 8 ++++---- changelog.txt | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Classes/PHPExcel/Writer/Excel5/Parser.php b/Classes/PHPExcel/Writer/Excel5/Parser.php index 981f8e60..1733ac4c 100644 --- a/Classes/PHPExcel/Writer/Excel5/Parser.php +++ b/Classes/PHPExcel/Writer/Excel5/Parser.php @@ -522,7 +522,7 @@ class PHPExcel_Writer_Excel5_Parser */ function _convert($token) { - if (preg_match("/^\"[^\"]{0,255}\"$/", $token)) { + if (preg_match("/\"([^\"]|\"\"){0,255}\"/", $token)) { return $this->_convertString($token); } elseif (is_numeric($token)) { @@ -1231,7 +1231,7 @@ class PHPExcel_Writer_Excel5_Parser return $token; } // If it's a string (of maximum 255 characters) - elseif (preg_match("/^\"[^\"]{0,255}\"$/",$token)) + elseif (preg_match("/\"([^\"]|\"\"){0,255}\"/",$token) and $this->_lookahead != '"' and (substr_count($token, '"')%2 == 0)) { return $token; } @@ -1323,8 +1323,8 @@ class PHPExcel_Writer_Excel5_Parser function _expression() { // If it's a string return a string node - if (preg_match("/^\"[^\"]{0,255}\"$/", $this->_current_token)) { - $result = $this->_createTree($this->_current_token, '', ''); + if (preg_match("/\"([^\"]|\"\"){0,255}\"/", $this->_current_token)) { + $result = $this->_createTree(str_replace('""', '"', $this->_current_token), '', ''); $this->_advance(); return $result; // If it's an error code diff --git a/changelog.txt b/changelog.txt index 14a6ea1d..cc1262b8 100644 --- a/changelog.txt +++ b/changelog.txt @@ -24,6 +24,7 @@ Fixed in SVN: +- Bugfix: (Progi1984) Workitem 7895 - Excel5 : Formula : String constant containing double quotation mark - Feature: (MBaker) Work item 8769 - Implement Gnumeric File Format Initial work on Gnumeric Reader (Worksheet Data, Document Properties and basic Formatting) - Feature: (MBaker) Support for Extended Workbook Properties in Excel2007, Excel5 and OOCalc Readers; support for User-defined Workbook Properties in Excel2007 and OOCalc Readers