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 Jun 12, 2019
1 parent d8154a9 commit a61fd9c
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 @@ -2736,7 +2736,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 a61fd9c

Please sign in to comment.