# -*- coding: utf-8 -*-
import io, os
HEAD = ['地点','周几','时段','人数','工作量','任意天数','备注']
ROWS = [
 ['科技支行','周一','全天',2,'中','','楼下实施'],
 ['钱新大楼','周一','全天',2,'高','','风险部18台工位调整（总行新大楼）'],
 ['钱新大楼','周一','全天',1,'中','','新大楼16台机位调整'],
 ['杭州双浦小微综合支行','周一','全天',1,'中','','双浦社区（原「双铺」笔误）'],
 ['杭州茅家埠社区支行','周一','全天',1,'中','','与双浦社区同一人'],
 ['清泰支行','周三','全天',2,'高','','PC16台+打印机12台+A3/A4扫描仪'],
 ['临平经济开发区支行','周三','全天',1,'中','','临平崇贤'],
 ['华成支行','周三','全天',1,'中','','周三或周四，此处按周三录入'],
 ['蒋村支行','周三','全天',1,'中','',''],
 ['官巷口支行','周三','全天',1,'中','','1人一天'],
 ['萧山瓜沥支行','周二、周三、周四、周五','上午',1,'中','','半天，5-6台PC工位调整'],
 ['城北支行','周一、周二、周三、周四、周五','全天',1,'中','','7台PC更新'],
 ['丁桥支行','周一','全天',1,'中','','电脑未装，需尽早排'],
 ['丁桥大唐苑社区支行','周一','全天',1,'中','','与丁桥同一批更新'],
 ['杭州青山湖科技城支行','周三、周五','全天',1,'中','是','对方改周三或周五，弹性'],
 ['临安支行','周三、周五','全天',1,'中','是','对方改周三或周五，弹性'],
]
def esc(x):
    x = str('' if x is None else x)
    return x.replace('&','&amp;').replace('<','&lt;').replace('>','&gt;')
trs = ''.join('<tr>' + ''.join('<td>%s</td>' % esc(c) for c in r) + '</tr>' for r in ROWS)
html = ('<html xmlns:x="urn:schemas-microsoft-com:office:excel"><head><meta charset="utf-8">'
 '<style>td,th{border:1px solid #999;padding:4px 8px;font-family:\u5fae\u8f6f\u96c5\u9ed1;font-size:11pt;mso-number-format:"\@"}'
 'th{background:#DCEBFB;font-weight:600}</style></head><body><table><thead><tr>'
 + ''.join('<th>%s</th>' % esc(h) for h in HEAD) +
 '</tr></thead><tbody>' + trs + '</tbody></table>'
 '<table style="margin-top:10px"><tbody>'
 '<tr><td style="border:0">\u8bf4\u660e</td><td style="border:0">\u672c\u8868\u53ef\u76f4\u63a5\u5bfc\u5165\u300c\u6392\u73ed\u5de5\u5177\u300d\uff1a\u8bbe\u7f6e \u2192 \u5bfc\u5165\u4efb\u52a1 Excel\u3002</td></tr>'
 '<tr><td style="border:0">\u8bf4\u660e</td><td style="border:0">\u5730\u70b9\u5199\u673a\u6784\u540d\u5173\u952e\u8bcd\u5373\u53ef\uff0c\u591a\u4e2a\u5730\u70b9\u7528\u987f\u53f7\u5206\u9694\u3002</td></tr>'
 '<tr><td style="border:0">\u8bf4\u660e</td><td style="border:0">\u4efb\u610f\u5929\u6570\u586b\u201c\u662f\u201d=\u5f39\u6027\u4efb\u52a1\uff0c\u53ea\u5728\u6240\u9009\u51e0\u5929\u91cc\u6311\u4e00\u5929\u6392\u3002</td></tr>'
 '</tbody></table></body></html>')
out = os.path.join(os.path.expanduser('~'), 'Desktop', '\u6392\u73ed\u4efb\u52a1_\u4e0b\u5468.xls')
io.open(out, 'w', encoding='utf-8').write('\ufeff' + html)
print(out, os.path.getsize(out), 'rows', len(ROWS))
