Example #1
0
 /**
  * @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);
     }
 }
Example #2
0
 /**
  * @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);
     }
 }
Example #3
0
 /**
  * @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();
     }
 }
Example #4
0
 /**
  * @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);
 }
Example #5
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);
     }
 }
Example #6
0
 /**
  * @param Cell           $cell
  * @param                $value
  * @param ReferenceTable $table
  *
  * @return mixed
  */
 public function parse(Cell $cell, $value, ReferenceTable &$table)
 {
     $cell->valign($value);
 }
Example #7
0
 /**
  * @param Cell           $cell
  * @param                $value
  * @param ReferenceTable $table
  *
  * @return mixed
  */
 public function parse(Cell $cell, $value, ReferenceTable &$table)
 {
     $cell->font()->family($value);
 }
Example #8
0
 /**
  * @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);
 }
Example #9
0
 /**
  * Add a cell.
  *
  * @param CellInterface $cell
  *
  * @return mixed
  */
 public function addCell(CellInterface $cell)
 {
     $this->cells[$cell->getCoordinate()->get()] = $cell;
 }