Baixo um exemplo de como criar.
header(‘Content-type: application/vnd.ms-excel; charset=iso-8859-1’);
header(“Content-Disposition: attachment; filename=list.xls”);
header(“Pragma: no-cache”);
header(“Expires: 0”);
Conteúdo:
$contents = “testdata1 \t testdata2 \t testdata3 \t \n”;
echo $contents;
Ou pode ser criado como uma tabela em html que fará o mesmo efeito, e também poderá ser formatada!
Para IE8, o cabeçalho deve ser assim:
header(“Pragma: public”);
header(“Expires: 0”);
header(“Cache-Control: must-revalidate, post-check=0, pre-check=0”);
header(“Content-Type: application/force-download”);
header(“Content-Type: application/octet-stream”);
header(“Content-Type: application/download”);;
header(“Content-Disposition: attachment;filename=list.xls”);
header(“Content-Transfer-Encoding: binary “);