How to Export Lists XLS istead of CSV?

A collection of tutorials and posts that show additional functionality of MATE

Moderator: KarelB

How to Export Lists XLS istead of CSV?

Postby kodcugenc » Mon Jan 31, 2011 9:20 pm

Nice script... But I want to learn that

How to Export Lists XLS with rows and cloumns like CSV?
kodcugenc
 
Posts: 7
Joined: Fri Jan 28, 2011 1:54 am

Re: How to Export Lists XLS istead of CSV?

Postby KarelB » Wed Feb 02, 2011 9:29 am

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
KarelB
 
Posts: 429
Joined: Mon Dec 01, 2008 11:49 pm
Location: The Netherlands

Re: How to Export Lists XLS istead of CSV?

Postby hexxamillion » Tue Jul 19, 2011 11:36 pm

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.
hexxamillion
 
Posts: 90
Joined: Fri Jul 08, 2011 11:36 pm

Re: How to Export Lists XLS istead of CSV?

Postby hexxamillion » Mon Jul 25, 2011 4:48 pm

Does anyone have any suggestions for IE?
hexxamillion
 
Posts: 90
Joined: Fri Jul 08, 2011 11:36 pm

Re: How to Export Lists XLS istead of CSV?

Postby KarelB » Mon Jul 25, 2011 5:06 pm

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?
KarelB
 
Posts: 429
Joined: Mon Dec 01, 2008 11:49 pm
Location: The Netherlands

Re: How to Export Lists XLS istead of CSV?

Postby hexxamillion » Mon Jul 25, 2011 9:46 pm

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.
hexxamillion
 
Posts: 90
Joined: Fri Jul 08, 2011 11:36 pm


Return to How To

Who is online

Users browsing this forum: No registered users and 1 guest

cron