mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-09-02 05:27:44 +00:00
Update Spreadsheet.php
This commit is contained in:
@@ -660,12 +660,10 @@ class Spreadsheet implements JsonSerializable
|
||||
*/
|
||||
public function getSheetByName(string $worksheetName): ?Worksheet
|
||||
{
|
||||
$worksheetCount = count($this->workSheetCollection);
|
||||
$trimWorksheetName = trim($worksheetName, "'");
|
||||
|
||||
for ($i = 0; $i < $worksheetCount; ++$i) {
|
||||
if (strcasecmp($this->workSheetCollection[$i]->getTitle(), $trimWorksheetName) === 0) {
|
||||
return $this->workSheetCollection[$i];
|
||||
foreach ($this->workSheetCollection as $worksheet) {
|
||||
if (strcasecmp($worksheet->getTitle(), $trimWorksheetName) === 0) {
|
||||
return $worksheet;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user