Bugfix: Workitem 14256 - Worksheet title exception when duplicate worksheet is being renamed but exceeds the 31 character limit

git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@61118 2327b42d-5241-43d6-9e2a-de5ac946f064
This commit is contained in:
Mark Baker 2010-09-18 12:45:22 +00:00
parent 5f5e793c05
commit 6925afdb91
2 changed files with 17 additions and 4 deletions

View File

@ -657,9 +657,21 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
if ($this->getParent()->getSheetByName($pValue)) { if ($this->getParent()->getSheetByName($pValue)) {
// Use name, but append with lowest possible integer // Use name, but append with lowest possible integer
if (PHPExcel_Shared_String::CountCharacters($pValue) > 29) {
$pValue = PHPExcel_Shared_String::Substring($pValue,0,29);
}
$i = 1; $i = 1;
while ($this->getParent()->getSheetByName($pValue . ' ' . $i)) { while ($this->getParent()->getSheetByName($pValue . ' ' . $i)) {
++$i; ++$i;
if ($i == 10) {
if (PHPExcel_Shared_String::CountCharacters($pValue) > 28) {
$pValue = PHPExcel_Shared_String::Substring($pValue,0,28);
}
} elseif ($i == 100) {
if (PHPExcel_Shared_String::CountCharacters($pValue) > 27) {
$pValue = PHPExcel_Shared_String::Substring($pValue,0,27);
}
}
} }
$altTitle = $pValue . ' ' . $i; $altTitle = $pValue . ' ' . $i;

View File

@ -41,7 +41,8 @@ Fixed in SVN:
- Bugfix: (MBaker) Workitem 14223 - Advanced Value Binder Not Working? - Bugfix: (MBaker) Workitem 14223 - Advanced Value Binder Not Working?
- Bugfix: (MBaker) Workitem 14226 - unassigned object variable in PHPExcel->removeCellXfByIndex - Bugfix: (MBaker) Workitem 14226 - unassigned object variable in PHPExcel->removeCellXfByIndex
- Bugfix: (MBaker) Workitem 14236 - problem with getting cell values from another worksheet... (if cell doesn't exist) - Bugfix: (MBaker) Workitem 14236 - problem with getting cell values from another worksheet... (if cell doesn't exist)
- Bugfix: (MBaker) Workitem 14260 & 14233 - Setting cell values to one char strings & Trouble reading one character string (thanks gorfou) - Bugfix: (MBaker) Workitems 14260 & 14233 - Setting cell values to one char strings & Trouble reading one character string (thanks gorfou)
- Bugfix: (MBaker) Workitem 14256 - Worksheet title exception when duplicate worksheet is being renamed but exceeds the 31 character limit
2010-08-26 (v1.7.4): 2010-08-26 (v1.7.4):