将带有图标的gridView导出到Outlook正文

时间:2019-10-25 18:38:29

标签: c# winforms outlook devexpress

这是我的gridView

enter image description here

这是我的将gridview导出到Outlook的代码

        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);

        string str;
        MemoryStream ms = new MemoryStream();
        try
        {
            gridView2.ExportToHtml(ms);
            ms.Seek(0, SeekOrigin.Begin);
            StreamReader sr = new StreamReader(ms);
            str = sr.ReadToEnd();
        }
        finally
        {
            ms.Close();
        }
        oMsg.To = "test@test.com";
        oMsg.Subject = "Test: ";
        oMsg.BodyFormat = Microsoft.Office.Interop.Outlook.OlBodyFormat.olFormatHTML;
        oMsg.Display(false); 

        oMsg.HTMLBody = "Test" + str +  oMsg.HTMLBody; 

代码可以正常工作,但图标不会显示在Outlook中 enter image description here

图标内置在gridview中
我怎么解决这个问题?

谢谢。
更新:我已经在Designer中使用ColumnView.FormatRules属性添加了IconSet
ColumnView.FormatRules

FormatRules Property in Designer

0 个答案:

没有答案