docPart = $docPart; $this->docPartId = $docPartId; $this->style = $this->setStyle(new TableStyle(), $style); } /** * Add a row * * @param int $height * @param mixed $style */ public function addRow($height = null, $style = null) { $row = new Row($this->docPart, $this->docPartId, $height, $style); $this->rows[] = $row; return $row; } /** * Add a cell * * @param int $width * @param mixed $style * @return \PhpOffice\PhpWord\Element\Cell */ public function addCell($width = null, $style = null) { $i = count($this->rows) - 1; $cell = $this->rows[$i]->addCell($width, $style); return $cell; } /** * Get all rows * * @return array */ public function getRows() { return $this->rows; } /** * Get table style * * @return TableStyle */ public function getStyle() { return $this->style; } /** * Set table width * * @param int $width */ public function setWidth($width) { $this->width = $width; } /** * Get table width * * @return int */ public function getWidth() { return $this->width; } }