/** * How many columns add/remove to coordinate * @param int $numCols positive value will add, negative will remove * @return Coordinate * @throws PhpExcelException */ public function shiftColBy($numCols = 0) { if (!is_int($numCols)) { throw new PhpExcelException('Only integer values are allowed.'); } $colNum = ExcelHelper::getExcelColumnNumber($this->col) + $numCols; if ($colNum < 1) { throw new PhpExcelException('Number of rows would get below 1.'); } $this->col = ExcelHelper::getExcelColumnName($colNum); return $this; }
/** * * @param array $header * @param array[] $data * @param string|null $sheetName * @param bool $doStandardFormatting * @return Worksheet */ public function addBasicSheet(array $header, array $data, $sheetName = null, $doStandardFormatting = true) { $sheet = $this->addSheet(); if ($sheetName) { $sheet->setTitle($sheetName); } $sheet->fromArray($header, null, 'A1'); if ($data) { $sheet->fromArray($data, null, 'A2'); } if ($doStandardFormatting) { $lastRow = count($data) + 1; $lastCol = count($header); $sheet->applyStandardSheetFormat('A1:' . ExcelHelper::getExcelColumnName($lastCol) . $lastRow); } return $sheet; }