def __call__(self):
book = xlwt.Workbook()
sheet = book.add_sheet(self.sheet_name)
rowx = 0
for colx, value in enumerate(self.headings):
sheet.write(rowx, colx, value)
sheet.set_panes_frozen(True) # frozen headings instead of split panes
sheet.set_horz_split_pos(rowx + 1) # in general, freeze after last heading row
sheet.set_remove_splits(True) # if user does unfreeze, don't leave a split there
for row in self.data:
rowx += 1
for colx, value in enumerate(row):
sheet.write(rowx, colx, value.encode('utf-8').decode('utf-8'))
buf = cStringIO.StringIO()
if self.file_name:
book.save(self.file_name)
book.save(buf)
out = base64.encodestring(buf.getvalue())
buf.close()
return out
# -*- coding: utf-8 -*-
some_code.py 文件源码
python
阅读 16
收藏 0
点赞 0
评论 0
评论列表
文章目录