【发布时间】:2019-09-13 15:30:51
【问题描述】:
我有一个代码,我从数据框中计算几个值并生成要传递给 Outlook 的 html。这个 html 也有一个我想要格式化的数据框表。但是 df.to_html 会生成一个未格式化的表格,我想根据条件应用条件格式。
上面的整个输出我想传递给 Outlook 以作为消息发送。
import win32com
o = win32com.client.Dispatch("Outlook.Application")
Msg = o.CreateItem(0)
Msg.HTMLBody = '<html><body>Today is {aaj}.<br><b>Pandas Table Output :</b> <br>{ComputerList}<br></body></html>'.format(aaj=din , ComputerList=SystemList[['System Name','IP Address','Updated','Value','OS Type','Status']].to_html(header=True, index=False, border=None))
Msg.Display()
我想为一列应用一些格式,如边框和单元格背景颜色,或在一列中应用条形符号。 在阅读了多页之后,我仍然无法做到这一点。 非常感谢任何工作帮助。
【问题讨论】:
标签: python html python-3.x pandas outlook