Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.
   1  <?php
   2  
   3  namespace Box\Spout\Writer\ODS;
   4  
   5  use Box\Spout\Writer\Common\Entity\Options;
   6  use Box\Spout\Writer\WriterMultiSheetsAbstract;
   7  
   8  /**
   9   * Class Writer
  10   * This class provides base support to write data to ODS files
  11   */
  12  class Writer extends WriterMultiSheetsAbstract
  13  {
  14      /** @var string Content-Type value for the header */
  15      protected static $headerContentType = 'application/vnd.oasis.opendocument.spreadsheet';
  16  
  17      /**
  18       * Sets a custom temporary folder for creating intermediate files/folders.
  19       * This must be set before opening the writer.
  20       *
  21       * @param string $tempFolder Temporary folder where the files to create the ODS will be stored
  22       * @throws \Box\Spout\Writer\Exception\WriterAlreadyOpenedException If the writer was already opened
  23       * @return Writer
  24       */
  25      public function setTempFolder($tempFolder)
  26      {
  27          $this->throwIfWriterAlreadyOpened('Writer must be configured before opening it.');
  28  
  29          $this->optionsManager->setOption(Options::TEMP_FOLDER, $tempFolder);
  30  
  31          return $this;
  32      }
  33  }