rows = array(); $this->columnCount = $columns; // Initialize parent parent::__construct(); // No resize proportional $this->resizeProportional = false; } /** * Get row * * @param int $row Row number * @param boolean $exceptionAsNull Return a null value instead of an exception? * @throws \Exception * @return \PhpOffice\PhpPresentation\Shape\Table\Row */ public function getRow($row = 0, $exceptionAsNull = false) { if (!isset($this->rows[$row])) { if ($exceptionAsNull) { return null; } throw new \Exception('Row number out of bounds.'); } return $this->rows[$row]; } /** * Get rows * * @return \PhpOffice\PhpPresentation\Shape\Table\Row[] */ public function getRows() { return $this->rows; } /** * Create row * * @return \PhpOffice\PhpPresentation\Shape\Table\Row */ public function createRow() { $row = new Row($this->columnCount); $this->rows[] = $row; return $row; } /** * @return int */ public function getNumColumns() { return $this->columnCount; } /** * @param int $numColumn * @return Table */ public function setNumColumns($numColumn) { $this->columnCount = $numColumn; return $this; } /** * Get hash code * * @return string Hash code */ public function getHashCode() { $hashElements = ''; foreach ($this->rows as $row) { $hashElements .= $row->getHashCode(); } return md5($hashElements . __CLASS__); } }