/** * @param Cell $cell * @param $value * @param ReferenceTable $table * * @return mixed */ public function parse(Cell $cell, $value, ReferenceTable &$table) { if ($value == 'italic') { $cell->font()->italic(); } elseif ($value == 'normal') { $cell->font()->italic(false); } }
/** * @param Cell $cell * @param $value * @param ReferenceTable $table * * @return mixed */ public function parse(Cell $cell, $value, ReferenceTable &$table) { if ($value == 'bold' || $value >= 500) { $cell->font()->bold(); } elseif ($value == 'normal' || $value < 500) { $cell->font()->bold(false); } }
/** * @param Cell $cell * @param $value * @param ReferenceTable $table * * @return mixed */ public function parse(Cell $cell, $value, ReferenceTable &$table) { switch ($value) { case 'underline': $cell->font()->underline(); case 'line-through': $cell->font()->strikethrough(); } }
/** * @param Cell $cell * @param $value * @param ReferenceTable $table * * @return mixed */ public function parse(Cell $cell, $value, ReferenceTable &$table) { if ($value == 'true') { $state = true; } if (!$value || $value == 'false') { $state = false; } $cell->align()->wrap($state); }
/** * @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); } }
/** * @param Cell $cell * @param $value * @param ReferenceTable $table * * @return mixed */ public function parse(Cell $cell, $value, ReferenceTable &$table) { $cell->valign($value); }
/** * @param Cell $cell * @param $value * @param ReferenceTable $table * * @return mixed */ public function parse(Cell $cell, $value, ReferenceTable &$table) { $cell->font()->family($value); }
/** * @param Cell $cell * @param $value * @param ReferenceTable $table * * @return mixed */ public function parse(Cell $cell, $value, ReferenceTable &$table) { list($style, $color) = $this->analyseBorder($value); $cell->borders()->top()->setColor($color)->setStyle($style); }
/** * Add a cell. * * @param CellInterface $cell * * @return mixed */ public function addCell(CellInterface $cell) { $this->cells[$cell->getCoordinate()->get()] = $cell; }