I have this code that export my report to html then show it on outlook body
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);
using (RepProjectInfoCH report = new RepProjectInfoCH())
{
report.DataSource = await ProjInfo.RepProjectInfoCH(idProject).ConfigureAwait(true);
string str;
MemoryStream ms = new MemoryStream();
try
{
report.ExportToHtml(ms);
ms.Seek(0, SeekOrigin.Begin);
using (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); //In order to display it in modal inspector change the argument to true
oMsg.HTMLBody = str + oMsg.HTMLBody; //Here comes your body;
}
All things go well except for images does not show in my outlook body. I expect this:
but I get this:
I tried to use
HtmlExportOptions htmlOptions = report.ExportOptions.Html;
htmlOptions.EmbedImagesInHTML = true;
but it seems to work with xrPictureBox only and I use xrCheckBox and all image are built-in within controls themselves