/** * @param array $row * @param Style $style */ public function addRow(array $row, Style $style = null) { if (!empty($row)) { $style = $style instanceof Style ? $style : $this->styler->getDefaultStyle(); $this->styler->addStyle($style); $this->sheetFile->fwrite($this->sheet->addRow($row, $style)); } }
/** * Wrap up the sheet (write header, column xmls). */ private function finalizeSheet() { $this->sheetFile->fwrite('</sheetData></worksheet>'); $this->sheetFile->rewind(); $this->sheetFile->fwrite(SheetXml::HEADER_XML); $this->sheetFile->fwrite($this->sheet->getDimensionXml()); $this->sheetFile->fwrite($this->sheet->getSheetViewsXml()); $this->sheetFile->fwrite($this->sheet->getColsXml()); $this->zip->addFile($this->sheetFile->getFilePath(), 'xl/worksheets/sheet1.xml'); }