pack() row and column into the required 3 or 4 byte format.

@access private
@param string $cell The Excel cell reference to be packed
@return array Array containing the row and column in packed() format
348046
function _cellToPackedRowcol($cell)
    {
        $cell = strtoupper($cell);
        list($row, $col, $row_rel, $col_rel) = $this->_cellToRowcol($cell);
        if ($col >= 256) {
            return $this->raiseError("Column in: $cell greater than 255");
        }
        // FIXME: change for BIFF8
        if ($row >= 16384) {
            return $this->raiseError("Row in: $cell greater than 16384 ");
        }

        // Set the high bits to indicate if row or col are relative.
        if ($this->_BIFF_version == 0x0500) {
            $row    |= $col_rel << 14;
            $row    |= $row_rel << 15;
            $col     = pack('C', $col);
        } elseif ($this->_BIFF_version == 0x0600) {
            $col    |= $col_rel << 14;
            $col    |= $row_rel << 15;
            $col     = pack('v', $col);
        }
        $row     = pack('v', $row);

        return array($row, $col);
    }
313119
protected function wrapCell($contents, $width)
    {
        // Account for left-indented cells.
        if (strpos($contents, ' ') === 0) {
            $trimmed = ltrim($contents, ' ');
            $indent = Helper::strlen($contents) - Helper::strlen($trimmed);

            return str_repeat(' ', $indent) . $this->wrapWithDecoration($trimmed, $width - $indent);
        }

        return $this->wrapWithDecoration($contents, $width);
    }
1244988
private function getTableCellWidth($total, $cells)
    {
        $widths = [];
        if (is_int($cells)) {
            $width = floor($total/$cells);
            for ($i=0; $i<$cells; ++$i) {
                $widths[] = $width;
            }
        }
        else if (is_array($cells)){
            $width = floor($total/count($cells));
            foreach ($cells as $i) {
                $widths[$i] = $width;
            }
        }
        return $widths;
    }
872316
public static function convertToArray($row)
    {
        $data = $row instanceof Arrayable ? $row->toArray() : (array) $row;

        foreach ($data as &$value) {
            if (is_object($value) || is_array($value)) {
                $value = self::convertToArray($value);
            }

            unset($value);
        }

        return $data;
    }
239487
public function getCellHelper($cell)
    {
        $renderer = lcfirst(str_replace('\\', '', get_class($cell)));
        if (method_exists($this->view, 'plugin')) {
            $helper = $this->view->plugin($renderer);
        }
        return $helper;
    }
772083
public function export(array &$rows)
    {
        $config     = $this->getConfiguration('export');
        $fieldNames = isset($config['fields']) ? $config['fields'] : null;
        $result     = array();

        if ($fieldNames) {
            foreach ($rows as &$row) {
                $exportRow = array();
                foreach ($fieldNames as $fieldName => $fieldCode) {
                    $exportRow[ $fieldName ] = $this->evaluateField($row, $fieldCode);
                }
                $result[] = $exportRow;
            }
        } else {
            $result = &$rows;
        }

        return $result;
    }
428909
public function merge($cell, $row, $numCell, $border=false){
        $style = array(
            'alignment' => array(
                'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER,)
        );
        $from = $this->getColumnName($cell) . $row;
        $to =  $this->getColumnName(($cell+$numCell - 1)) . $row;
        $this->engine->getActiveSheet()->mergeCells("$from:$to");
        $this->engine->getActiveSheet()->getStyle("$from:$to")
             ->applyFromArray($style);
        if($border){
            $this->engine->getActiveSheet()->getStyle("$from:$to")
                ->applyFromArray($this->style);
        }
        return $this;
    }
1345968
protected function __cells():string{
		$abbr    = $this->getAttribute('abbr');
		$colspan = $this->getAttribute('colspan');
		$rowspan = $this->getAttribute('rowspan');

		if($colspan){
			$colspan = ' colspan="'.intval($colspan).'"';
		}

		if($rowspan){
			$rowspan = ' rowspan="'.intval($rowspan).'"';
		}

		if($this->tag === 'th' && $abbr){
			$abbr = ' abbr="'.$abbr.'"';
		}

		return '<'.$this->tag.$colspan.$rowspan.$abbr.$this->__getCellStyle().'>'.$this->eol($this->content, '<br/>').'</'.$this->tag.'>';
	}
979901
private function findCellExpectedAnswer(Cell $cell)
    {
        $best = null;
        foreach ($cell->getChoices() as $choice) {
            /** @var CellChoice $choice */
            if (empty($best) || $best->getScore() < $choice->getScore()) {
                $best = $choice;
            }
        }

        return $best;
    }
932567
private function _pack($script)
    {
        for ($i = 0; isset($this->_parsers[$i]); $i++) {
            $script = call_user_func(array(&$this, $this->_parsers[$i]), $script);
        }

        return $script;
    }
971873
private function convertColumns(array $row)
    {
        $result = [];

        foreach ($row as $fieldName => $value) {
            if (is_null($value)) {
                $result[$fieldName] = null;
                continue;
            }
            switch($this->columnTypes[$fieldName]) {
                case self::BOOL:
                    $value = is_null($value) ? null : $value == 't';
                    break;
                case self::INTEGER:
                case self::SMALLINT:
                case self::BIGINT:
                    $value = (int) $value;
                    break;
                case self::NUMERIC:
                    $value = (float) $value;
                    break;
                case self::JSON:
                    $value = json_decode($value, true);
                    break;
                case self::HSTORE:
                    $value = self::fromHStore($value);
                    break;
                case self::DATE:
                case self::TIMESTAMP:
                case self::TIMESTAMPTZ:
                    $value = self::fromTimestamp($value);
                    break;
                case self::SMALLINT_ARRAY:
                case self::INTEGER_ARRAY:
                    $value = self::fromArray($value);
                    if (!is_null($value)) {
                        $value = array_map(function($a) {
                            return $a === 'NULL' ? null : intval($a);
                        }, $value);
                    }
                    break;
                case self::BIGINT_ARRAY:
                case self::NUMERIC_ARRAY:
                    $value = self::fromArray($value);
                    if (!is_null($value)) {
                        $value = array_map(function($a) {
                            return $a === 'NULL' ? null : doubleval($a);
                        }, $value);
                    }
                    break;
                case self::TEXT_ARRAY:
                case self::VARCHAR_ARRAY:
                case self::CHAR_ARRAY:
                    $value = self::fromArray($value);
                    break;
                case self::HSTORE_ARRAY:
                    $array = self::fromArray($value);
                    $value = [];
                    foreach ($array as $val) {
                        $value[] = self::fromHStore($val);
                    }
                    break;
                case self::JSON_ARRAY:
                    $array = self::fromArray($value);
                    $value = [];
                    foreach ($array as $val) {
                        $value[] = json_decode($val, true);
                    }
                    break;
                case self::INTERVAL:
                    $value = self::fromInterval($value);
                    break;
            }

            $result[$fieldName] = $value;
        }
        return $result;
    }
807417
public function toArray() {
        $arr = array();
        foreach ($this->cells as $key => $cell) {
            $arr[] = $cell->toArray();
        }
        return $arr;
    }
472917
public function appendCell($cell, $name = null)
    {
        $cell = $this->buildCell($cell);
        if ($name == null && $cell->getName() != '') {
            $name = $cell->getName();
        }

        if ($name == null) {
            $this->cells[] = $cell;
        } else {
            $this->cells[$name] = $cell;
        }
        end($this->cells);
        $cell->setName(key($this->cells));

        return $this;
    }
902804
protected function explodeToColumns($row)
    {
    	$columns = explode($this->separator,$row);
        foreach($columns as $column => $value) {
            $columns[$column] = trim($value);
        }
        return $columns;
    }
166580
public function getCell($row, $col) {
		if ($row < 2 && $this->hasOnlyCols($this->count()))
			return $this->getItem($col);
		$row=$this->getItem($row);
		if (isset($row)) {
			$col=$row->getItem($col);
		}
		return $col;
	}
447383
protected function _calculateWidths($rows)
    {
        $widths = [];
        foreach ($rows as $line) {
            foreach (array_values($line) as $k => $v) {
                $columnLength = $this->_cellWidth($v);
                if ($columnLength >= (isset($widths[$k]) ? $widths[$k] : 0)) {
                    $widths[$k] = $columnLength;
                }
            }
        }

        return $widths;
    }
33520
private static function getExcel(array $data)
    {
        $excel = new \PHPExcel();
        $row = 1;
        $col = 0;
        $sheet = $excel->getActiveSheet();
        foreach ($data as $d) {
            if (is_array($d)) {
                foreach ($d as $dd) {
                    $sheet->getCellByColumnAndRow($col, $row)->setValue((string)$dd);
                    $col++;
                }
                $col = 0;
            } else {
                $sheet->getCellByColumnAndRow($col, $row)->setValue((string)$d);
            }
            $row++;
        }
        return $excel;
    }