I have the following C# code to launch an outlook window. The one think i want开发者_Python百科 to add it to have certain part of the text bold and italics. how would i do that through this API?
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);
Microsoft.Office.Interop.Outlook.Recipient oRecip;
oMsg.Subject = "Autogenerated Daily Report for: " + DateTime.Now.Date.AddDays(-1).ToString("MMM dd");
oMsg.Body = message;
oRecip = (Microsoft.Office.Interop.Outlook.Recipient)oMsg.Recipients.Add("test@test.com");
oRecip.Resolve();
oMsg.Display(true);
oRecip = null;
oMsg = null;
oApp = null;
Make your message HTML, and use HTML tags as necessary to get the formatting you want.
Example:
.BodyFormat = OlBodyFormat.olFormatHTML
.HTMLBody = "<html><body><h2>The body of this message will appear in HTML." +
"</h2>Type the Message text here.</body></html>";
精彩评论