You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Set worksheet title the same as an existing worksheet title and a title is added with a count number at the end
What is the current behavior?
When adding two sheets of the same name and same case feature works
But when different case is used, the sheet titles are not recognised as the same (but Excel does and complains about it)
What are the steps to reproduce?
<?phprequire__DIR__ . '/vendor/autoload.php';
// Create new Spreadsheet object$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
$index=1;
$spreadsheet->createSheet();
$sheet = $excel->setActiveSheetIndex($index);
$sheet->setTitle('My Same Sheet');
$index++;
$spreadsheet->createSheet();
$sheet = $excel->setActiveSheetIndex($index);
$sheet->setTitle('My Same Sheet');
$index++;
$spreadsheet->createSheet();
$sheet = $excel->setActiveSheetIndex($index);
$sheet->setTitle('My Different Sheet');
$index++;
$spreadsheet->createSheet();
$sheet = $excel->setActiveSheetIndex($index);
$sheet->setTitle('My different Sheet');
// Output sheet, all works fine but when opening in Excel needs to 'Correct data', last sheet will become named 'Recovered_Sheet1'
To be honest I've not run this specific test but it mimics what my code is doing.
I have fixed it by changing PHPExcel->getSheetByName() to use:
if (strcasecmp($this->workSheetCollection[$i]->getTitle(),$pName)===0) {
return $this->workSheetCollection[$i];
}
Which versions of PhpSpreadsheet and PHP are affected?
PHP 7
PhpSpreadsheet latest
The text was updated successfully, but these errors were encountered:
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If this is still an issue for you, please try to help by debugging it further and sharing your results.
Thank you for your contributions.
This is:
What is the expected behavior?
Set worksheet title the same as an existing worksheet title and a title is added with a count number at the end
What is the current behavior?
When adding two sheets of the same name and same case feature works
But when different case is used, the sheet titles are not recognised as the same (but Excel does and complains about it)
What are the steps to reproduce?
To be honest I've not run this specific test but it mimics what my code is doing.
I have fixed it by changing PHPExcel->getSheetByName() to use:
Which versions of PhpSpreadsheet and PHP are affected?
PHP 7
PhpSpreadsheet latest
The text was updated successfully, but these errors were encountered: