Question

I've been trying to get PHPExcel to work with my Joomla. If the script saves it into file, it works fine but when I'm trying to output it to the browser for download, the file will give a warning 'File extension or file format is not valid'. My guess would be something to do with the Content-Type being served. Any ideas on how to make it work?

Headers I've placed in view.xlsx.php:

// Redirect output to a client’s web browser (Excel2007)
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
header('Content-Disposition: attachment;filename="01simple.xlsx"');
header('Cache-Control: max-age=0');

This is actually a copy and paste from their example which I can assure works fine in their own script. The problem is when I'm running it in Joomla.

Was it helpful?

Solution

Take a look at this entry from the Joomla forums; and watch out for potential clashes with the autoloader

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top