Sunday, June 3, 2012

Re: Is there a way to generate the excel spreadsheet using cakephp?


There's probably a "proper" way, but I've previously had good success with:

- generate a bare html table with your data (no need for any surrounding page layout)
- serve the html content with a mime-type of application/vnd.ms-excel
- set a header of: Content-Disposition: attachment; filename="name_of_excel_file.xls"

Excel will open your html table with an .xls file extension, and when the user saves, the file gets saved as a proper excel document.  And you haven't had to fiddle around with any half-baked excel file making libraries.

Cheers
Daniel.

On Sun, Jun 3, 2012 at 9:22 PM, alvin567 <defalcator@gmail.com> wrote:
Is there a way to generate the excel spreadsheet using cakephp?

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php



--
Daniel Baird
I've tried going to the XHTML <bar /> a few times, but it's always closed.

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: