Trong khi googling tôi tìm thấy hai bộ tiêu đề khác nhau cần được đặt khi xuất excel được tạo ở định dạng tệp khác.PHPExcel đặt tiêu đề cụ thể cho định dạng tệp
ví dụ:
Đối Loại "Excel5" tiêu đề là:
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=$filename");
header("Content-Transfer-Encoding: binary ");
Đối Loại "Excel2007" tiêu đề là:
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
header('Content-Disposition: attachment;filename="myfile.xlsx"');
header('Cache-Control: max-age=0');
Câu hỏi của tôi: là có cần phải thiết lập tiêu đề khác nhau cho mỗi loại tệp cũng như có các loại tệp khác cũng là CSV, HTML và PDF?