Example #1
0
 /**
  * @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);
     }
 }