Bugfix: Reduced false positives from isDateTimeFormatCode() method by suppressing testing within quoted strings (thanks to John Machin, author of xlrd, and the maintainer of xlwt for reading/writing Excel files in Python)

git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@68308 2327b42d-5241-43d6-9e2a-de5ac946f064
This commit is contained in:
Mark Baker 2011-02-10 12:26:50 +00:00
parent 4a33c85f26
commit 8218d04b0f
2 changed files with 13 additions and 0 deletions

View File

@ -262,6 +262,18 @@ class PHPExcel_Shared_Date
} }
// Try checking for any of the date formatting characters that don't appear within square braces // Try checking for any of the date formatting characters that don't appear within square braces
if (preg_match('/(^|\])[^\[]*['.self::$possibleDateFormatCharacters.']/i',$pFormatCode)) { if (preg_match('/(^|\])[^\[]*['.self::$possibleDateFormatCharacters.']/i',$pFormatCode)) {
// We might also have a format mask containing quoted strings...
// we don't want to test for any of our characters within the quoted blocks
if (strpos($pFormatCode,'"') !== false) {
$i = false;
foreach(explode('"',$pFormatCode) as $subVal) {
// Only test in alternate array entries (the non-quoted blocks)
if (($i = !$i) && (preg_match('/(^|\])[^\[]*['.self::$possibleDateFormatCharacters.']/i',$subVal))) {
return true;
}
}
return false;
}
return true; return true;
} }

View File

@ -59,6 +59,7 @@ Fixed in SVN:
Default row argument for all __ByColumnAndRow() methods should be 1 Default row argument for all __ByColumnAndRow() methods should be 1
- Bugfix: (MBaker) Work item 15121 - Column reference rather than cell reference in Print Area definition - Bugfix: (MBaker) Work item 15121 - Column reference rather than cell reference in Print Area definition
Fix Excel2007 Writer to handle print areas that are defined as row or column ranges rather than just as cell ranges Fix Excel2007 Writer to handle print areas that are defined as row or column ranges rather than just as cell ranges
- Bugfix: (MBaker) Reduced false positives from isDateTimeFormatCode() method by suppressing testing within quoted strings
- General: (MBaker) Improved performance (speed), for building the Shared Strings table in the Excel2007 Writer. - General: (MBaker) Improved performance (speed), for building the Shared Strings table in the Excel2007 Writer.
- General: (MBaker) Enhanced SheetViews element structures in the Excel2007 Writer for frozen panes. - General: (MBaker) Enhanced SheetViews element structures in the Excel2007 Writer for frozen panes.