Page 1 of 1

How to Export Lists XLS istead of CSV?

PostPosted: Mon Jan 31, 2011 9:20 pm
by kodcugenc
Nice script... But I want to learn that

How to Export Lists XLS with rows and cloumns like CSV?

Re: How to Export Lists XLS istead of CSV?

PostPosted: Wed Feb 02, 2011 9:29 am
by KarelB
There seem to be many solutions to this issue but I have solved this in the following way.
Replace the export header section with:
Code: Select all
      header('Cache-Control: no-cache, must-revalidate');
      header('Pragma: no-cache');
      header("Content-type: application/x-msdownload");
      header("Expires: 0");
      header('Content-Disposition: attachment; filename="'.$this->Editor->tableName.'.xls"');
     


BTW You might get faster responses on questions when you post them in the "Open Discussion" forum

Re: How to Export Lists XLS istead of CSV?

PostPosted: Tue Jul 19, 2011 11:36 pm
by hexxamillion
This works in firefox but not IE for me. I have IE8 and it'd still trying to download as an HTML type doc and errors if I try to save. In firefox this works flawless. Any suggestions? It's like it's trying to download the .php page rather than the .xls file containing the table data.

If I choose open instead of save in IE then it just displays unformatted text output of the table data.

Re: How to Export Lists XLS istead of CSV?

PostPosted: Mon Jul 25, 2011 4:48 pm
by hexxamillion
Does anyone have any suggestions for IE?

Re: How to Export Lists XLS istead of CSV?

PostPosted: Mon Jul 25, 2011 5:06 pm
by KarelB
Although I normally try to avoid using IE :-), my userbase does and they do not complain with the posted solution.

Does the export display correctly if you have excel already open before the export? Is the xls extension correctly associated with excel?

Re: How to Export Lists XLS istead of CSV?

PostPosted: Mon Jul 25, 2011 9:46 pm
by hexxamillion
I read online somewhere this has to do with some security mumbojumbo in IE8. Apparently other web developers have the same issue in other web apps with exporting. I have no issue whatsoever with Firefox but that is no good because my userbase uses IE8.

Does anyone have another workaround ? perhaps offering an alternate link for IE users?? i dunno. I will still look into this in the meantime.