vb.net 将 HTML 表格添加到 Outlook 正文
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17431282/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-17 14:06:59 来源:igfitidea点击:
Add HTML table to Outlook Body
提问by coder
I am trying to use Outlookto send mails and I need to add HTML tableinside my Outlook body.
我试图用来Outlook发送邮件,我需要HTML table在我的Outlook body.
This is what I have done but it is trying to add the HTMLtagsbut not the design.
这是我所做的,但它试图添加HTMLtags但不是design.
Dim body As String
objOutlook = CType(CreateObject("Outlook.Application"), Outlook.Application)
objEmail = objOutlook.CreateItem(Outlook.OlItemType.olMailItem)
Dim strb As New StringBuilder
strb.Append("<table width='600px' align='center' border='0' cellpadding='0' cellspacing='0' style='border-top:5px solid white;'")
strb.Append("<tr><td>S.No</td><td>AccountID</td><td>ChargeEntryControl</td><td>PaymentPostingControl</td></tr></table>")
body = "Hi,
body += strb.ToString
回答by APrough
Here is the full code I used, and it displays the email as I believe you want.
这是我使用的完整代码,它显示了我认为您想要的电子邮件。
Dim body As String
Dim objOutlook As Object
Dim objEmail As Object
objOutlook = CType(CreateObject("Outlook.Application"), Outlook.Application)
objEmail = objOutlook.CreateItem(Outlook.OlItemType.olMailItem)
Dim strb As New StringBuilder
strb.Append("<table width='600px' align='center' border='0' cellpadding='0' cellspacing='0' style='border-top:5px solid white;'")
strb.Append("<tr><td>S.No</td><td>AccountID</td><td>ChargeEntryControl</td><td>PaymentPostingControl</td></tr></table>")
body = "Hi,"
body += strb.ToString
objEmail.htmlbody = body
objEmail.display()

