0

I have been trying to save html data in excel format(export to excel functionality basically) in PHP. I achieved that by changing header to

                header("Content-type: application/vnd.ms-excel");
                header("Content-Disposition: attachment; filename=$filename");
                header("Pragma: no-cache");
                header("Expires: 0");

But on opening the file, it shows a warning for above excel 2003 applications. So can I save the excel in 2008 or 2010 format just by modifying the header or do I have to go for other frameworks providing this feature like "PHPExcel" or something. And yes, I am using CodeIgniter for my website

Thanks in advance.

Ganapat
  • 6,984
  • 3
  • 24
  • 38
  • http://stackoverflow.com/questions/2937465/what-is-correct-content-type-for-excel-files i think its just using the proper content type – tomexsans Jun 25 '13 at 11:08

2 Answers2

0

You need to use some libraries to generate Excel tables.

Standart HTML output is not converted automatically to the specified format if you only set the Content-Type you want.

Michael Sivolobov
  • 12,388
  • 3
  • 43
  • 64
0

Try changing the MIME type to:

application/vnd.openxmlformats-officedocument.spreadsheetml.sheet

instead of

application/vnd.ms-excel