Hi, all friends.
I'm using PyExelerator to create Excel report for users to download. I tried
to save the Workbook object to a StringIO which is said a file-like object,
but the result is an empty file. Following are the codes:
def get_report():
#.... generating workbook codes
f = StringIO.StringIO()
doc = CompoundDoc.XlsDoc()
doc.save_to(f,w.get_biff_data())
#the "doc.save_to" func was added to the Workbook class in the
pyExelerator's module by myself. There was a original
#"save" method there take two argument, the first one is a file object,
the second one is the same as mine.
response.headers['Content-type']='application/vnd.ms-excel'
response.headers['Content-Disposition']='attachment; filename=test.xls'
response.headers['Content-Title']='test.xls'
response.headers['Content-Length'] = f.tell()
f.seek(0)
return f.read()
What's the problem? Thanks in advance.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py-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/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---