Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 310 and 401] [Versions 311 and 401] [Versions 39 and 401] [Versions 401 and 402] [Versions 401 and 403]

   1  <?php
   2  
   3  namespace PhpOffice\PhpSpreadsheet\Reader;
   4  
   5  interface IReader
   6  {
   7      public const LOAD_WITH_CHARTS = 1;
   8  
   9      /**
  10       * IReader constructor.
  11       */
  12      public function __construct();
  13  
  14      /**
  15       * Can the current IReader read the file?
  16       */
  17      public function canRead(string $filename): bool;
  18  
  19      /**
  20       * Read data only?
  21       *        If this is true, then the Reader will only read data values for cells, it will not read any formatting information.
  22       *        If false (the default) it will read data and formatting.
  23       *
  24       * @return bool
  25       */
  26      public function getReadDataOnly();
  27  
  28      /**
  29       * Set read data only
  30       *        Set to true, to advise the Reader only to read data values for cells, and to ignore any formatting information.
  31       *        Set to false (the default) to advise the Reader to read both data and formatting for cells.
  32       *
  33       * @param bool $readDataOnly
  34       *
  35       * @return IReader
  36       */
  37      public function setReadDataOnly($readDataOnly);
  38  
  39      /**
  40       * Read empty cells?
  41       *        If this is true (the default), then the Reader will read data values for all cells, irrespective of value.
  42       *        If false it will not read data for cells containing a null value or an empty string.
  43       *
  44       * @return bool
  45       */
  46      public function getReadEmptyCells();
  47  
  48      /**
  49       * Set read empty cells
  50       *        Set to true (the default) to advise the Reader read data values for all cells, irrespective of value.
  51       *        Set to false to advise the Reader to ignore cells containing a null value or an empty string.
  52       *
  53       * @param bool $readEmptyCells
  54       *
  55       * @return IReader
  56       */
  57      public function setReadEmptyCells($readEmptyCells);
  58  
  59      /**
  60       * Read charts in workbook?
  61       *        If this is true, then the Reader will include any charts that exist in the workbook.
  62       *      Note that a ReadDataOnly value of false overrides, and charts won't be read regardless of the IncludeCharts value.
  63       *        If false (the default) it will ignore any charts defined in the workbook file.
  64       *
  65       * @return bool
  66       */
  67      public function getIncludeCharts();
  68  
  69      /**
  70       * Set read charts in workbook
  71       *        Set to true, to advise the Reader to include any charts that exist in the workbook.
  72       *      Note that a ReadDataOnly value of false overrides, and charts won't be read regardless of the IncludeCharts value.
  73       *        Set to false (the default) to discard charts.
  74       *
  75       * @param bool $includeCharts
  76       *
  77       * @return IReader
  78       */
  79      public function setIncludeCharts($includeCharts);
  80  
  81      /**
  82       * Get which sheets to load
  83       * Returns either an array of worksheet names (the list of worksheets that should be loaded), or a null
  84       *        indicating that all worksheets in the workbook should be loaded.
  85       *
  86       * @return mixed
  87       */
  88      public function getLoadSheetsOnly();
  89  
  90      /**
  91       * Set which sheets to load.
  92       *
  93       * @param mixed $value
  94       *        This should be either an array of worksheet names to be loaded, or a string containing a single worksheet name.
  95       *        If NULL, then it tells the Reader to read all worksheets in the workbook
  96       *
  97       * @return IReader
  98       */
  99      public function setLoadSheetsOnly($value);
 100  
 101      /**
 102       * Set all sheets to load
 103       *        Tells the Reader to load all worksheets from the workbook.
 104       *
 105       * @return IReader
 106       */
 107      public function setLoadAllSheets();
 108  
 109      /**
 110       * Read filter.
 111       *
 112       * @return IReadFilter
 113       */
 114      public function getReadFilter();
 115  
 116      /**
 117       * Set read filter.
 118       *
 119       * @return IReader
 120       */
 121      public function setReadFilter(IReadFilter $readFilter);
 122  
 123      /**
 124       * Loads PhpSpreadsheet from file.
 125       *
 126       * @return \PhpOffice\PhpSpreadsheet\Spreadsheet
 127       */
 128      public function load(string $filename, int $flags = 0);
 129  }