public function finish()
    {
        $writer = $this->writer;
        if (!$writer) {
            $writer = PHPExcel_IOFactory::createWriter($this->excel, $this->format);
        }
        $writer->save($this->filename);
    }