diff --git a/lib/excellib.class.php b/lib/excellib.class.php index b2731b2626b..b75f173a06e 100644 --- a/lib/excellib.class.php +++ b/lib/excellib.class.php @@ -160,7 +160,7 @@ class MoodleExcelWorksheet { */ public function __construct($name, PHPExcel $workbook) { // Replace any characters in the name that Excel cannot cope with. - $name = strtr($name, '[]*/\?:', ' '); + $name = strtr(trim($name, "'"), '[]*/\?:', ' '); // Shorten the title if necessary. $name = core_text::substr($name, 0, 31);