MDL-37753 dataformat: Only set worksheet name where implemented
authorBrendan Heywood <brendan@catalyst-au.net>
Thu, 28 Apr 2016 04:34:33 +0000 (14:34 +1000)
committerDan Poltawski <dan@moodle.com>
Fri, 29 Apr 2016 11:17:58 +0000 (12:17 +0100)
lib/classes/dataformat/spout_base.php

index 29c8ed4..434b18c 100644 (file)
@@ -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);
         }