/** * 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 }