Php – how to download excel file in internet explorer browser with phpexcel library

downloadinternet explorerPHPphpexcel

i have written code that is working in Mozilla firefox but not working in internet explorer
i cannot solve it. in internet explorer its complete page loding with out popup download .
i need to generete excel file with IE support also.please help me.

here is my code.


$objPHPExcel = new PHPExcel();

$objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('B')->setWidth(18);



$objPHPExcel->setActiveSheetIndex(0)   
                           ->setCellValue('A1', 'Agent Code')
                  ->setCellValue('B1', 'Month');                       
$i=2;   
            while($row1=mysql_fetch_array($rs))
                    {
                    $month = $row1['smonth']+1;
                    $month_name = date( 'F', mktime(0, 0, 0, $month) );
        $objPHPExcel->setActiveSheetIndex(0)
                ->setCellValue('A'.$i, $row1['scode'])
                ->setCellValue('B'.$i, $month_name)
                ->setCellValue('C'.$i, $row1['syear']);
                 $i++;              
 } 
$objPHPExcel->getActiveSheet()->setTitle('Simple');
$objPHPExcel->setActiveSheetIndex(0);
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment;filename="01simple.xls"');
header('Cache-Control: max-age=0');

$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save('php://output');

exit;

Best Answer

This is complete solution use header('Pragma: ');