Skip to content

Commit 5b61d6c

Browse files
[XLSX] Fix sheet title extract function
XLSX extractSheetTitle return the quote character in sheet name Fix PHPOffice#739
1 parent deb4837 commit 5b61d6c

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/PhpSpreadsheet/Worksheet/Worksheet.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2696,7 +2696,14 @@ public static function extractSheetTitle($pRange, $returnRange = false)
26962696
}
26972697

26982698
if ($returnRange) {
2699-
return [substr($pRange, 0, $sep), substr($pRange, $sep + 1)];
2699+
$sheet = substr($pRange, 0, $sep);
2700+
if (($pos = strpos($sheet, "'")) !== false) {
2701+
$sheet = substr_replace($sheet, '', $pos, 1);
2702+
}
2703+
if (($pos = strrpos($sheet, "'")) !== false) {
2704+
$sheet = substr_replace($sheet, '', $pos, 1);
2705+
}
2706+
return [$sheet, substr($pRange, $sep + 1)];
27002707
}
27012708

27022709
return substr($pRange, $sep + 1);

0 commit comments

Comments
 (0)