/** * Flush the cells * @param LaravelExcelWorksheet $sheet * @param string $column * @param integer $row * @param string $cellContent * @return void */ private function _flushCell($sheet, &$column, $row, &$cellContent) { $cell = $sheet->getCell($column . $row); foreach ($sheet->getMergeCells() as $mergedCells) { if ($cell->isInRange($mergedCells)) { preg_match("/(.*):(.*?)/u", $mergedCells, $matches); // skip the first item in the merge if ($matches[1] != $column . $row) { $newCol = \PHPExcel_Cell::stringFromColumnIndex(\PHPExcel_Cell::columnIndexFromString($column) + 1 - 1); $column = $newCol; $this->_flushCell($sheet, $newCol, $row, $cellContent); } } } if (is_string($cellContent)) { // Simple String content if (trim($cellContent) > '') { // Only actually write it if there's content in the string // Write to worksheet to be done here... // ... we return the cell so we can mess about with styles more easily $cell = $sheet->setCellValue($column . $row, $cellContent, true); $this->_dataArray[$row][$column] = $cellContent; } } else { // We have a Rich Text run // TODO $this->_dataArray[$row][$column] = 'RICH TEXT: ' . $cellContent; } $cellContent = (string) ''; }