diff --git a/public/grade/export/xls/grade_export_xls.php b/public/grade/export/xls/grade_export_xls.php index ec4bbcd2d15..f81b0e25846 100644 --- a/public/grade/export/xls/grade_export_xls.php +++ b/public/grade/export/xls/grade_export_xls.php @@ -45,9 +45,6 @@ class grade_export_xls extends grade_export { $strgrades = get_string('grades'); - // If this file was requested from a form, then mark download as complete (before sending headers). - \core_form\util::form_download_complete(); - // Calculate file name $shortname = format_string($this->course->shortname, true, array('context' => context_course::instance($this->course->id))); $downloadfilename = clean_filename("$shortname $strgrades.xls"); diff --git a/public/lib/excellib.class.php b/public/lib/excellib.class.php index ff300752c77..812535df4ed 100644 --- a/public/lib/excellib.class.php +++ b/public/lib/excellib.class.php @@ -110,6 +110,9 @@ class MoodleExcelWorkbook { public function close() { global $CFG; + // If this file was requested from a form, then mark download as complete. + \core_form\util::form_download_complete(); + foreach ($this->objspreadsheet->getAllSheets() as $sheet) { $sheet->setSelectedCells('A1'); }