Skip to content

Instantly share code, notes, and snippets.

@vijay07roy
Forked from vielhuber/index.php
Created September 27, 2018 08:03
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vijay07roy/7bb673b7cbe9226e77630296921fda3f to your computer and use it in GitHub Desktop.
Save vijay07roy/7bb673b7cbe9226e77630296921fda3f to your computer and use it in GitHub Desktop.
PHPExcel output directly to browser #php
<?php
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
header('Content-Disposition: attachment;filename="' . $filename . '.xlsx"');
$objWriter->save('php://output');
die();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment