/** * Add a cell * * @param int $width * @param mixed $style * @return \PhpOffice\PhpWord\Element\Cell */ public function addCell($width = null, $style = null) { $cell = new Cell($width, $style); $cell->setParentContainer($this); $this->cells[] = $cell; return $cell; }
/** * Add a cell * * @param int $width * @param mixed $style * @return \PhpOffice\PhpWord\Element\Cell */ public function addCell($width = null, $style = null) { $cell = new Cell($width, $style); $cell->setDocPart($this->getDocPart(), $this->getDocPartId()); $cell->setPhpWord($this->phpWord); $cell->setNestedLevel($this->getNestedLevel()); $this->cells[] = $cell; return $cell; }
/** * Write cell. * * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Element\Cell $cell * @return void */ private function writeCell(XMLWriter $xmlWriter, CellElement $cell) { $xmlWriter->startElement('w:tc'); // Write style $cellStyle = $cell->getStyle(); if ($cellStyle instanceof CellStyle) { $styleWriter = new CellStyleWriter($xmlWriter, $cellStyle); $styleWriter->setWidth($cell->getWidth()); $styleWriter->write(); } // Write content $containerWriter = new Container($xmlWriter, $cell); $containerWriter->write(); $xmlWriter->endElement(); // w:tc }
/** * Get elements */ public function testGetElements() { $oCell = new Cell('section', 1); $this->assertInternalType('array', $oCell->getElements()); }