Controller/FormAdminController.php
protected function createResponse(PHPExcel $excel, $fileName)
    {
        $writer = new PHPExcel_Writer_Excel2007($excel);
        ob_start();
        $writer->save('php://output');
        $content = ob_get_clean();
        $response = new Response();
        $response->headers->set('Content-Type', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
        $response->headers->set('Content-Disposition', 'attachment;filename="'.$fileName.'"');
        $response->headers->set('Cache-Control', 'max-age=0');
        $response->setContent($content);

        return $response;
    }
protected function createResponse(PHPExcel $excel, $fileName)
    {
        $writer = new PHPExcel_Writer_Excel2007($excel);
        ob_start();
        $writer->save('php://output');
        $content = ob_get_clean();
        $response = new Response();
        $response->headers->set('Content-Type', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
        $response->headers->set('Content-Disposition', 'attachment;filename="'.$fileName.'"');
        $response->headers->set('Cache-Control', 'max-age=0');
        $response->setContent($content);

        return $response;
    }
protected function createResponse ( PHPExcel $ excel , $ fileName ) { $ writer = new PHPExcel_Writer_Excel2007 ( $ excel ) ; ob_start ( ) ; $ writer -> save ( 'php://output' ) ; $ content = ob_get_clean ( ) ; $ response = new Response ( ) ; $ response -> headers -> set ( 'Content-Type' , 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' ) ; $ response -> headers -> set ( 'Content-Disposition' , 'attachment;filename="' . $ fileName . '"' ) ; $ response -> headers -> set ( 'Cache-Control' , 'max-age=0' ) ; $ response -> setContent ( $ content ) ; return $ response ; }
Generates a response object for a PHPExcel object.

@param PHPExcel $excel
@param $fileName

@return Response
Generates a response object for a PHPExcel object .