From c32bcfe751689a09d7b2f7dcc114b8ca0c021f1d Mon Sep 17 00:00:00 2001 From: Brendan Heywood Date: Thu, 28 Apr 2016 13:01:27 +1000 Subject: [PATCH 1/2] MDL-53973 tablelib: Fixed bug with worksheetname being ignored --- lib/tablelib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tablelib.php b/lib/tablelib.php index ce3ff202fe5..3ab007025a0 100644 --- a/lib/tablelib.php +++ b/lib/tablelib.php @@ -1730,7 +1730,6 @@ class table_dataformat_export_format extends table_default_export_format_parent $this->filename = $filename; $this->documentstarted = true; $this->dataformat->set_filename($filename); - $this->dataformat->send_http_headers(); } /** @@ -1740,6 +1739,7 @@ class table_dataformat_export_format extends table_default_export_format_parent */ public function start_table($sheettitle) { $this->dataformat->set_sheettitle($sheettitle); + $this->dataformat->send_http_headers(); } /** From dae21986aae01a81aea164b9a6b221e93095f76b Mon Sep 17 00:00:00 2001 From: Brendan Heywood Date: Thu, 28 Apr 2016 14:34:33 +1000 Subject: [PATCH 2/2] MDL-37753 dataformat: Only set worksheet name where implemented --- lib/classes/dataformat/spout_base.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/classes/dataformat/spout_base.php b/lib/classes/dataformat/spout_base.php index 29c8ed48fb7..434b18c86a7 100644 --- a/lib/classes/dataformat/spout_base.php +++ b/lib/classes/dataformat/spout_base.php @@ -51,7 +51,7 @@ abstract class spout_base extends \core\dataformat\base { $this->writer = \Box\Spout\Writer\WriterFactory::create($this->spouttype); $filename = $this->filename . $this->get_extension(); $this->writer->openToBrowser($filename); - if ($this->sheettitle) { + if ($this->sheettitle && $this->writer instanceof \Box\Spout\Writer\AbstractMultiSheetsWriter) { $sheet = $this->writer->getCurrentSheet(); $sheet->setName($this->sheettitle); }