MDL-65762 lib: Update of Spout wrapper and docs.
authorAdrian Greeve <abgreeve@gmail.com>
Mon, 17 Jun 2019 01:50:07 +0000 (09:50 +0800)
committerAdrian Greeve <abgreeve@gmail.com>
Mon, 17 Jun 2019 01:57:35 +0000 (09:57 +0800)
lib/classes/dataformat/spout_base.php
lib/spout/readme_moodle.txt
lib/thirdpartylibs.xml

index 6b0c10b..f7d8a74 100644 (file)
@@ -51,7 +51,7 @@ abstract class spout_base extends \core\dataformat\base {
      * Output file headers to initialise the download of the file.
      */
     public function send_http_headers() {
-        $this->writer = \Box\Spout\Writer\WriterFactory::create($this->spouttype);
+        $this->writer = \Box\Spout\Writer\Common\Creator\WriterEntityFactory::createWriter($this->spouttype);
         if (method_exists($this->writer, 'setTempFolder')) {
             $this->writer->setTempFolder(make_request_directory());
         }
@@ -79,7 +79,7 @@ abstract class spout_base extends \core\dataformat\base {
      * @param array $columns
      */
     public function start_sheet($columns) {
-        if ($this->sheettitle && $this->writer instanceof \Box\Spout\Writer\AbstractMultiSheetsWriter) {
+        if ($this->sheettitle && $this->writer instanceof \Box\Spout\Writer\WriterMultiSheetsAbstract) {
             if ($this->renamecurrentsheet) {
                 $sheet = $this->writer->getCurrentSheet();
                 $this->renamecurrentsheet = false;
@@ -88,7 +88,8 @@ abstract class spout_base extends \core\dataformat\base {
             }
             $sheet->setName($this->sheettitle);
         }
-        $this->writer->addRow(array_values((array)$columns));
+        $row = \Box\Spout\Writer\Common\Creator\WriterEntityFactory::createRowFromArray((array)$columns);
+        $this->writer->addRow($row);
     }
 
     /**
@@ -98,7 +99,8 @@ abstract class spout_base extends \core\dataformat\base {
      * @param int $rownum
      */
     public function write_record($record, $rownum) {
-        $this->writer->addRow(array_values((array)$record));
+        $row = \Box\Spout\Writer\Common\Creator\WriterEntityFactory::createRowFromArray((array)$record);
+        $this->writer->addRow($row);
     }
 
     /**
index 91ace6b..c7b9e71 100644 (file)
@@ -1,9 +1,14 @@
-Description of Spout library import 2.7.3
+Description of Spout library import 3.0.1
 =========================================
 * Download / Clone from https://github.com/box/spout/
 * Only include the src/Spout directory.
 * Update lib/thirdpartylibs.xml with the latest version.
 
+2019/06/17
+----------
+Update to v3.0.1 (MDL-65762)
+by Adrian Greeve <adrian@moodle.com>
+
 2017/10/10
 ----------
 Updated to v2.7.3 (MDL-60288)
index ed721af..c4b0ae8 100644 (file)
     <location>spout</location>
     <name>Spout</name>
     <license>Apache</license>
-    <version>2.7.3</version>
+    <version>3.0.1</version>
     <licenseversion>2.0</licenseversion>
   </library>
   <library>