Try replacing

    workbook.save('output.xls')
    return response

with

    workbook.save('output.xls')
    response.write(open('output.xls', 'b').read())
    return response

regards
 Steve

laspal wrote:
> So how can I fix it.
> I am not able to fix it.
> Thanks
>
> On Oct 30, 4:26 pm, Steve Holden <[EMAIL PROTECTED]> wrote:
>   
>> laspalwrote:
>>     
>>> Any one can help me out.
>>> Thanks.
>>>       
>>> On Oct 29, 11:41 am,laspal<[EMAIL PROTECTED]> wrote:
>>>       
>>>> Hi,
>>>> I am trying to create Excel file usingpyExceleratorbut my problem is
>>>> I am not able
>>>> to attach file to response.
>>>>         
>>>> code :
>>>>     workbook = Workbook()
>>>>     worksheet = workbook.add_sheet('My Test Sheet')
>>>>         
>>>>     worksheet.write(0,0, 'Company', font_style('left', 1, 'red'))
>>>>     worksheet.write(1,1, 'Hello World!', font_style('left', 1,
>>>> 'black'))
>>>>     worksheet.write(1,0, 'Hello World!', font_style('left', 1, 'red'))
>>>>         
>>>>     response = HttpResponse( mimetype='application/vnd.ms-excel')
>>>>     response['Content-Disposition'] = 'attachment;
>>>> filename=output.xls'
>>>>     workbook.save('output.xls')
>>>>         
>>>>    return response.
>>>>         
>>>> I am able to generate output.xl file but without any data.
>>>> Can anyone help me out
>>>> Thanks.
>>>>         
>> Correction: the "Content-Disposition" header is fine, but you do need to
>> write the file contents to the response.
>>
>> regards
>>  Steve
>> --
>> Steve Holden        +1 571 484 6266   +1 800 494 3119
>> Holden Web LLC              http://www.holdenweb.com/
>>     
> >
>
>   



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to