[python] zope - mime - ms excel

Joseph O'Ruanaidh joruanaidh na genuone.com
Středa Listopad 5 00:09:22 CET 2003


Thanks for the code below. It was helpful to me.
I now have:

container.REQUEST.RESPONSE.setHeader('Content-type',
'application/vnd.ms-excel')
container.REQUEST.RESPONSE.setHeader('Content-disposition',
'attachment; filename=temp.xls')

I noticed a small spelling mistake: "text/semicolon-seperated-values"

Should this be: "text/semicolon-separated-values" ?

Joe


#container.REQUEST.RESPONSE.setHeader('Content-type', 'text/x-cvs')
#container.REQUEST.RESPONSE.setHeader('Content-type',
'application/vnd.ms-excel')
container.REQUEST.RESPONSE.setHeader('Content-type',
'text/semicolon-seperated-values')
container.REQUEST.RESPONSE.setHeader('Expires',  'Mon, 26 Jul 1997 05:00:00
GMT') # Date in the past
container.REQUEST.RESPONSE.setHeader('Cache-Control', 'no-store, no-cache,
must-revalidate') # HTTP/1.1
container.REQUEST.RESPONSE.setHeader('Cache-Control', 'post-check=0,
pre-check=0')
container.REQUEST.RESPONSE.setHeader('Pragma', 'no-cache') # HTTP/1.0
print "user id;Real name;Assignment;Odevzdano;Hodnoceni"
for i in 
context.DBQ_assignment_predmet(assignment=formdictionary["predmet"]):
    rname = str(i["realname"])
    rname = string.replace(rname, "  ", " ")
    rname = string.rstrip(rname)
    print
str(i["user_id"])+';'+rname+';'+str(i["predmet"])+';'+str(i["odevzdano1"])+';'+str(i["hodnoceni1"])





Další informace o konferenci Python