You could also use xlwt to generate excel files:

Docs: https://secure.simplistix.co.uk/svn/xlwt/trunk/xlwt/doc/xlwt.html
Examples: https://secure.simplistix.co.uk/svn/xlwt/trunk/xlwt/examples/

Regards,
Carlos Ruvalcaba

On Fri, Nov 4, 2011 at 2:50 PM, Rotem Tamir <[email protected]> wrote:
> The way I'm using is this:
>
> I have a template file with something like
>
> ${grid(data)}
>
> where grid is a DataGrid object and data is a list of database records
> from SqlAlchemy
>
> To serve this I'm doing:
>
> @expose('project.templates.excel',content_type="application/vnd.ms-
> excel")
>
> this way the browser thinks it's receiving a true MS-Excel file but
> actualy receiving an html table (from DataGrid) - turns out excel
> proceses this just fine!
>
> good luck
>
> Rotem
>
>
>
> On Nov 4, 7:10 pm, Sean DiZazzo <[email protected]> wrote:
>> Hi,
>>
>> I'm trying to make a generic widget that can export whatever records
>> are being shown in a DataGrid.  I have the code to generate the file
>> and to serve it up to the user using cherrypy, but I'm brain farting
>> on how to pass the records in to the widget.  I want to just be able
>> to pass them in via the template like you do with a datagrid.  ie $
>> {export_records(records).display()}.
>>
>> I started trying to make a simple form with only the submit button,
>> but then I realized I couldn't get the records attached to the form.
>> I could do it with a form the way I was trying to do it if I
>> reselected the records from the database again, but I want to just
>> have the button use the same records that were already filtered down
>> by the controller method.  All I need the button to do is call a
>> function with the passed in records, and I should be able to create
>> the spreadsheet and serve it up.  I think I am missing something
>> obvious.  Any advice?
>>
>> ~Sean
>
> --
> You received this message because you are subscribed to the Google Groups 
> "TurboGears" 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/turbogears?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"TurboGears" 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/turbogears?hl=en.

Reply via email to