Can you show the code you are using to get the data from the db to xlwt?

Anthony

On Tuesday, July 24, 2012 10:49:13 AM UTC-4, joe wrote:
>
> I am using xlwt to export the data (I want an excel file, and a bit more 
> control over format).  I recently made it work, in about the most clumsy 
> way possible (getting a row object from the referenced table, casting it 
> into a string, and finding the substring that I want to display), but there 
> has to be a simpler way.
>
> Thanks!
> -Joe Peacock
>
> On Tuesday, July 24, 2012 9:36:22 AM UTC-5, Anthony wrote:
>>
>> How are you exporting the data? The export_to_csv_file() method, for 
>> example, takes a "represent" argument -- if set to True, it will use each 
>> field's "represent" attribute to convert the values before exporting.
>>
>> Anthony
>>
>> On Tuesday, July 24, 2012 9:59:15 AM UTC-4, joe wrote:
>>>
>>> Hello
>>>
>>> I am working with xlwt and trying to export a table of mine into a .xls 
>>> file.  This table contains some foreign keys, and they are being exported 
>>> as the id of the other table rathan than the 'name' field, which is what I 
>>> want to display.  I define the foreign key fields in the table like this:
>>>
>>>
>>> Field('owner', db.person, requires = IS_EMPTY_OR(IS_IN_DB(db, db.person, 
>>> '%(name)s')), represent=lambda id, row: db.person(id).name if id else ' '),
>>>
>>> Thanks!
>>>
>>

-- 



Reply via email to