2012-07-26 48 views
0

我可以使用下面的代碼保存Excel文件:「另存爲」嚮導CSV文件在Python

f = cStringIO.StringIO() # This is a buffer to Store the above values 
wb.save(f) # This will save the buffer 
output_data=base64.encodestring(f.getvalue()) 
res = self.write(cr, uid, ids, {'state':'get','data':output_data, 'name':'kpi.xls'}, context=context) 
return res 

但我不能使用保存保存CSV文件嚮導。

+0

「另存爲嚮導」是什麼? – 2012-07-26 06:55:24

+0

我只想保存文件在我的系統中的任何特定位置。就像下載嚮導一樣。 – 2012-07-26 06:57:09

+0

您的代碼不完整。它似乎是某個班級的一部分,但即使你粘貼的方法也不完整。 – Tadeck 2012-07-26 06:59:46

回答

0

代碼和解釋是不完整的,但從我的理解,你需要一個「另存爲」對話框。 tkFileDialogTkinter應該做的伎倆。

filename = tkFileDialog.asksaveasfilename() 
res = self.write(cr, uid, ids, {'state':'get','data':output_data, 'name':filename}, context=context)