From 77ef51b716084559906265b36bb90850f128048a Mon Sep 17 00:00:00 2001 From: Guillaume RODRIGUEZ Date: Fri, 26 Oct 2018 15:50:38 +0200 Subject: [PATCH] [XLSX] Fix sheet title extract function XLSX extractSheetTitle return the quote character in sheet name Fix #739 --- src/PhpSpreadsheet/Worksheet/Worksheet.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/PhpSpreadsheet/Worksheet/Worksheet.php b/src/PhpSpreadsheet/Worksheet/Worksheet.php index e2b0dd8771..ce4e2dcc3f 100644 --- a/src/PhpSpreadsheet/Worksheet/Worksheet.php +++ b/src/PhpSpreadsheet/Worksheet/Worksheet.php @@ -2690,7 +2690,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);