温馨提示:本文翻译自stackoverflow.com,查看原文请点击:c# - Outlook HTMLBody refuses to output the font size I specified, no matter the value
c# html outlook winforms

c# - Outlook HTMLBody拒绝输出我指定的字体大小,无论其值如何

发布于 2020-04-07 11:22:52

我有此代码发送电子邮件抛出前景

Microsoft.Office.Interop.Outlook.Application oApp = new Microsoft.Office.Interop.Outlook.Application(); 
Microsoft.Office.Interop.Outlook.MailItem oMsg = (Microsoft.Office.Interop.Outlook.MailItem)oApp.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem); 
oMsg.To = "test@test.com"; oMsg.CC = "test1@test.com"; oMsg.Subject = "Fiche De Non-Confoemité N°: " + txtOrderNumber.Text+"/"+ txtCreationDate.DateTime.Year; 
oMsg.BodyFormat = Microsoft.Office.Interop.Outlook.OlBodyFormat.olFormatHTML; 
oMsg.Display(false); 
oMsg.HTMLBody = "<font size='18px'>"+"Un nouveau fiche de non-confoemité a été ajouté: "+ 
                "<br />" + "N°: " + txtOrderNumber.Text + "/" + txtCreationDate.DateTime.Year +
                "<br />" + "Détecteur: " + cmbDetecteurStructure.Text +
                "<br />" + "Personne Concernée: " + cmbRelevantEmployee.Text +
                "<br />" + "Date: " + txtCreationDate.Text +
                "<br />" + "Crée par « Smart Industrial Management »" +"</font>"+ oMsg.HTMLBody ;

我尝试使用不同的值(14,16,18,20),但是在Outlook中总是以相同的大小(10)结束。
我怎么解决这个问题 ?。

查看更多

提问者
M.Bouabdallah
被浏览
36
Roman.Pavelko 2020-02-01 02:04

span例如,将您的文本换行,然后添加style到其中:

<span style=\"font-size:16px\">Un nouveau fiche de non-confoemité a été ajouté:</span>

或仅应用于style您的font标签:

<font style=\"font-size:16px\">