/** * @param Cell $cell */ public function write(Cell $cell) { $coordinate = $cell->getCoordinate()->get(); /* * CELL VALUE */ if ($cell->getDataType()) { $this->sheet->getCell($coordinate)->setValueExplicit($cell->getValue(), (string) $cell->getDataType()); } else { $this->sheet->getCell($coordinate)->setValue($cell->getValue()); } /* * NUMBER FORMAT */ $this->sheet->getStyle($coordinate)->getNumberFormat()->setFormatCode((string) $cell->getFormat()); /* * CELL STYLES */ if ($cell->hasStyles()) { $styles = (new StyleWriter())->convert($cell->getStyles()); $this->sheet->getStyle($coordinate)->applyFromArray($styles); } }
/** * Add a cell. * * @param CellInterface $cell * * @return mixed */ public function addCell(CellInterface $cell) { $this->cells[$cell->getCoordinate()->get()] = $cell; }