Incorrect rendering of SSRS HTML in Outlook

There seems to be a limitation in outlook when rendering emails which have SSRS reports embedded within them where tables widths are smaller than expected.

To get around this place a text box in the headerfooterbody with a continues alphanumeric string. Also, set the InteractiveSize property within the report to 0,0 so that no paging will display within the email.

Results after the change:

Example URL:

http://server/ReportServer?%2fReportName&rs:Command=Render&rc:Format=HTML4.0&rc:Toolbar=False&rc:HTMLFragment=True

Code used to send the email:

private void EmailNewProduct()
{
MailMessage mail = new MailMessage();
mail.From = new MailAddress(_mailFrom);
mail.To.Add(_mailTo);
mail.Subject = _mailSubject;
mail.IsBodyHtml = true;
// Build the request to get the report
WebRequest request = WebRequest.Create(_reportUrl);
request.Credentials = CredentialCache.DefaultCredentials;
request.Timeout = _reportTimeout;
// Get the report and add it to the email body.
WebResponse response = request.GetResponse();
using (StreamReader streaReader = new StreamReader(response.GetResponseStream()))
{
mail.Body = streaReader.ReadToEnd();
}
SmtpClient smtp = new SmtpClient(_smtpServer);
smtp.Send(mail);
}
private void EmailNewProduct() { MailMessage mail = new MailMessage(); mail.From = new MailAddress(_mailFrom); mail.To.Add(_mailTo); mail.Subject = _mailSubject; mail.IsBodyHtml = true;
// Build the request to get the report WebRequest request = WebRequest.Create(_reportUrl); request.Credentials = CredentialCache.DefaultCredentials; request.Timeout = _reportTimeout;
// Get the report and add it to the email body. WebResponse response = request.GetResponse(); using (StreamReader streaReader = new StreamReader(response.GetResponseStream())) { mail.Body = streaReader.ReadToEnd(); }
SmtpClient smtp = new SmtpClient(_smtpServer); smtp.Send(mail); }

Advertisements

2 thoughts on “Incorrect rendering of SSRS HTML in Outlook

Comments are closed.