Bugfix: Work item 17262 - Named Range definition in .xls when sheet reeference is quote wrapped

git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@85313 2327b42d-5241-43d6-9e2a-de5ac946f064
This commit is contained in:
Mark Baker 2012-01-15 12:06:04 +00:00
parent a22e46f328
commit ac37b8ae8d
2 changed files with 15 additions and 9 deletions

View File

@ -501,6 +501,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
* *
* @param string $pFileName * @param string $pFileName
* @return boolean * @return boolean
* @throws Exception
*/ */
public function canRead($pFilename) public function canRead($pFilename)
{ {
@ -1041,16 +1042,21 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
$explodes = explode('!', $definedName['formula']); $explodes = explode('!', $definedName['formula']);
if (count($explodes) == 2) { if (count($explodes) == 2) {
if ($docSheet = $this->_phpExcel->getSheetByName($explodes[0])) { if (($docSheet = $this->_phpExcel->getSheetByName($explodes[0])) ||
($docSheet = $this->_phpExcel->getSheetByName(trim($explodes[0],"'")))) {
$extractedRange = $explodes[1]; $extractedRange = $explodes[1];
$extractedRange = str_replace('$', '', $extractedRange); $extractedRange = str_replace('$', '', $extractedRange);
$localOnly = ($definedName['scope'] == 0) ? false : true; $localOnly = ($definedName['scope'] == 0) ? false : true;
$scope = ($definedName['scope'] == 0) ? $scope = ($definedName['scope'] == 0) ?
null : $this->_phpExcel->getSheetByName($this->_sheets[$definedName['scope'] - 1]['name']); null : $this->_phpExcel->getSheetByName($this->_sheets[$definedName['scope'] - 1]['name']);
$this->_phpExcel->addNamedRange( new PHPExcel_NamedRange((string)$definedName['name'], $docSheet, $extractedRange, $localOnly, $scope) ); $this->_phpExcel->addNamedRange( new PHPExcel_NamedRange((string)$definedName['name'], $docSheet, $extractedRange, $localOnly, $scope) );
} }
} else {
// Named Value
// TODO Provide support for named values
} }
} }
} }
@ -6278,7 +6284,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
$value += $mantissalow2 / pow (2 , (52 - $exp)); $value += $mantissalow2 / pow (2 , (52 - $exp));
if ($sign) { if ($sign) {
$value = -1 * $value; $value *= -1;
} }
return $value; return $value;
@ -6288,8 +6294,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
{ {
if (($rknum & 0x02) != 0) { if (($rknum & 0x02) != 0) {
$value = $rknum >> 2; $value = $rknum >> 2;
} } else {
else {
// changes by mmp, info on IEEE754 encoding from // changes by mmp, info on IEEE754 encoding from
// research.microsoft.com/~hollasch/cgindex/coding/ieeefloat.html // research.microsoft.com/~hollasch/cgindex/coding/ieeefloat.html
// The RK format calls for using only the most significant 30 bits // The RK format calls for using only the most significant 30 bits
@ -6363,7 +6368,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
*/ */
public static function _GetInt2d($data, $pos) public static function _GetInt2d($data, $pos)
{ {
return ord($data[$pos]) | (ord($data[$pos + 1]) << 8); return ord($data[$pos]) | (ord($data[$pos+1]) << 8);
} }
/** /**
@ -6385,7 +6390,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
} else { } else {
$_ord_24 = ($_or_24 & 127) << 24; $_ord_24 = ($_or_24 & 127) << 24;
} }
return ord($data[$pos]) | (ord($data[$pos + 1]) << 8) | (ord($data[$pos + 2]) << 16) | $_ord_24; return ord($data[$pos]) | (ord($data[$pos+1]) << 8) | (ord($data[$pos+2]) << 16) | $_ord_24;
} }
/** /**

View File

@ -52,6 +52,7 @@ Fixed in SVN:
- Bugfix: (fauvel) Work item 16958 - Cell::getFormattedValue returns RichText object instead of string - Bugfix: (fauvel) Work item 16958 - Cell::getFormattedValue returns RichText object instead of string
- Bugfix: (MBaker) Work item 17166 - Indexed colors do not refer to Excel's indexed colors? - Bugfix: (MBaker) Work item 17166 - Indexed colors do not refer to Excel's indexed colors?
- Bugfix: (MBaker) Work item 17199 - Indexed colors should be consistent with Excel and start from 1 (current index starts at 0) - Bugfix: (MBaker) Work item 17199 - Indexed colors should be consistent with Excel and start from 1 (current index starts at 0)
- Bugfix: (MBaker) Work item 17262 - Named Range definition in .xls when sheet reeference is quote wrapped
- General: (MBaker) Work item 15405 - Two easy to fix Issues concerning PHPExcel_Token_Stack (l10n/UC) - General: (MBaker) Work item 15405 - Two easy to fix Issues concerning PHPExcel_Token_Stack (l10n/UC)
- General: (MBaker) Work item 15461 - Locale file paths not fit for windows - General: (MBaker) Work item 15461 - Locale file paths not fit for windows
- General: (MBaker) Work item 16643 - Add file directory as a cache option for cache_to_discISAM - General: (MBaker) Work item 16643 - Add file directory as a cache option for cache_to_discISAM