Skip to content

Commit

Permalink
[XLSX] Fix sheet title extract function
Browse files Browse the repository at this point in the history
XLSX extractSheetTitle return the quote character in sheet name

Fix PHPOffice#739
  • Loading branch information
guillaume-ro-fr committed Oct 28, 2018
1 parent fdc224a commit 1077030
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/PhpSpreadsheet/Worksheet/Worksheet.php
Original file line number Diff line number Diff line change
Expand Up @@ -2734,7 +2734,14 @@ public static function extractSheetTitle($pRange, $returnRange = false)
}

if ($returnRange) {
return [substr($pRange, 0, $sep), substr($pRange, $sep + 1)];
$sheet = substr($pRange, 0, $sep);
if (($pos = strpos($sheet, "'")) !== false) {
$sheet = substr_replace($sheet, '', $pos, 1);
}
if (($pos = strrpos($sheet, "'")) !== false) {
$sheet = substr_replace($sheet, '', $pos, 1);
}
return [$sheet, substr($pRange, $sep + 1)];
}

return substr($pRange, $sep + 1);
Expand Down

0 comments on commit 1077030

Please sign in to comment.