how can i use javascript after download excel ?

Topics: User Forum
Aug 29, 2012 at 12:35 PM
Edited Aug 29, 2012 at 12:43 PM

Hello.

phpexcel export and download file take a long time.
so, i want display waiting dialog. like this...

<script>
    alert ( "download start.." );
</script>
<?
   ....
    header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
    header('Content-Disposition: attachment;filename="' . "test.xlsx". ';"' );
    header('Cache-Control: max-age=0');
    
    $this->_objPHPExcel->setActiveSheetIndex(0);
    
   // take a long time job.
    $objWriter = PHPExcel_IOFactory::createWriter($this->_objPHPExcel, 'Excel2007');
    $objWriter->save('php://output'); 
?>
<script>
    alert ( "download completed !!" );
</script>

but, "test.xlsx" file is corrupted.
$objWriter->save('php://output');   <<=   good work when this line comments.

I want show waiting information( progress bar, waiting dialog, etc ) to user  while phpexcel work and download.

Thank you.

Aug 31, 2012 at 12:00 PM

See my response here : https://phpexcel.codeplex.com/discussions/393770

Don't permit a progress bar, but a accurate 'please wait'.

IMHO, using alert() for this is not very nice... and, in my case, downloading the file is quick, but building the file take some time.