Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

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

   1  <?php
   2  
   3  namespace PhpOffice\PhpSpreadsheet\Worksheet;
   4  
   5  class Row
   6  {
   7      /**
   8       * \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet.
   9       *
  10       * @var Worksheet
  11       */
  12      private $worksheet;
  13  
  14      /**
  15       * Row index.
  16       *
  17       * @var int
  18       */
  19      private $rowIndex = 0;
  20  
  21      /**
  22       * Create a new row.
  23       *
  24       * @param Worksheet $worksheet
  25       * @param int $rowIndex
  26       */
  27      public function __construct(?Worksheet $worksheet = null, $rowIndex = 1)
  28      {
  29          // Set parent and row index
  30          $this->worksheet = $worksheet;
  31          $this->rowIndex = $rowIndex;
  32      }
  33  
  34      /**
  35       * Destructor.
  36       */
  37      public function __destruct()
  38      {
  39          $this->worksheet = null;
  40      }
  41  
  42      /**
  43       * Get row index.
  44       *
  45       * @return int
  46       */
  47      public function getRowIndex()
  48      {
  49          return $this->rowIndex;
  50      }
  51  
  52      /**
  53       * Get cell iterator.
  54       *
  55       * @param string $startColumn The column address at which to start iterating
  56       * @param string $endColumn Optionally, the column address at which to stop iterating
  57       *
  58       * @return RowCellIterator
  59       */
  60      public function getCellIterator($startColumn = 'A', $endColumn = null)
  61      {
  62          return new RowCellIterator($this->worksheet, $this->rowIndex, $startColumn, $endColumn);
  63      }
  64  
  65      /**
  66       * Returns bound worksheet.
  67       *
  68       * @return Worksheet
  69       */
  70      public function getWorksheet()
  71      {
  72          return $this->worksheet;
  73      }
  74  }