/** * Add cell */ public function testAddCell() { $oRow = new Row('section', 1); $element = $oRow->addCell(); $this->assertInstanceOf('PhpOffice\\PhpWord\\Element\\Cell', $element); $this->assertCount(1, $oRow->getCells()); }
/** * Write row. * * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Element\Row $row * @return void */ private function writeRow(XMLWriter $xmlWriter, RowElement $row) { $xmlWriter->startElement('w:tr'); // Write style $rowStyle = $row->getStyle(); if ($rowStyle instanceof RowStyle) { $styleWriter = new RowStyleWriter($xmlWriter, $rowStyle); $styleWriter->setHeight($row->getHeight()); $styleWriter->write(); } // Write cells foreach ($row->getCells() as $cell) { $this->writeCell($xmlWriter, $cell); } $xmlWriter->endElement(); // w:tr }
/** * Write row * * @return string */ private function writeRow(RowElement $row) { $content = ''; // Write cells foreach ($row->getCells() as $cell) { $content .= $this->writeCell($cell); } return $content; }