I have found PHPExcel to consume a LOT of memory. Was trying to export
30,000 rows, lots of memory issues.
Memory issues were resolved when I switched to the pear libary
SPREADSHEET_EXCEL_WRITER
Which I would recommend, it is a little bit buggy, but will do for
most things.
Your other option as Fabrice suggested is modify the HTTP headers.
Here is a good tutorial on how to do this: http://symfonynerds.com/blog/?p=14
this is great for simple stuff

On Feb 20, 11:36 pm, cleve <[email protected]> wrote:
> I use Fabrice's HTML table formatted as Excel method, but also
> consider ....
>
> or usehttp://www.kunalbabre.com/projects/table2CSV.php
>
> On Feb 20, 10:58 am, Fabrice B <[email protected]> wrote:
>
> > I know three solutions to do Excel exports.
>
> >  - Csv
>
> > It is in my opinion not an interesting one, unless your rows are
> > already formatted into arrays. In that case implode(';',$row) might be
> > interesting
>
> >  - HTML table formatted as Excel
>
> > This is a nice trick I once discovered. You can do a simple HTML table
> > in your template, and just add the following lines to your action
> >     $this->setLayout(false);
> >     $response = $this->getContext()->getResponse();
> >     $response->clearHttpHeaders();
> >     $response->setHttpHeader('Content-Type', 'application/vnd.ms-
> > excel;charset=utf-8');
> >     $response->setHttpHeader('Content-Disposition:', 'attachment;
> > filename=export.xls');
>
> > Excel will open your html table as if it were an excel file and you
> > will not see the difference
>
> >  - PHPEscel
>
> > If you want better formatting, include pictures, etc. then use the
> > following very good class :http://www.codeplex.com/PHPExcel
>
> > As for using the filters in your export, you will need to look in your
> > cache folder at the auto-generated action of your admin generator and
> > find the functions which create the criteria from the filters and call
> > them from your own export action. This should work :
>
> > public function executeExportExcel()
> > {
> >     $this->processSort();
> >     $this->processFilters();
> >     $this->filters = $this->getUser()->getAttributeHolder()->getAll
> > ('sf_admin/bar/filters');
> >     $c = new Criteria();
> >     $this->addSortCriteria($c);
> >     $this->addFiltersCriteria($c);
>
> >     $this->objects_to_export = ObjectPeer::doSelect$c);
>
> >     // if you use solution 2 :
> >     $this->setLayout(false);
> >     $response = $this->getContext()->getResponse();
> >     $response->clearHttpHeaders();
> >     $response->setHttpHeader('Content-Type', 'application/vnd.ms-
> > excel;charset=utf-8');
> >     $response->setHttpHeader('Content-Disposition:', 'attachment;
> > filename=export.xls');
>
> > }
>
> > Fabrice
> > --http://www.allomatch.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to