SSRS Tips : Fixing Format Issues in MHTML Rendered SSRS Reports

Impetus

The impetus for writing this blog came from a recent issue I faced while setting up email based subscription for one of my MIS reports for enterprise wide distribution. The report content had to be embedded within the email in HTML format so I had set the rendering option as MHTML for the subscription. When report is delivered using subscription it can be noticed that none of the formatting, cosmetic settings on the original report gets applied. 
This article explains how you can overcome this issue to preserve the native format settings you applied to the report while rendering it through automated subscriptions in MHTML format.

Illustration

Consider the below report created in SSRS

The requirement was to schedule an automated delivery of the above report through email to a list of users. The report has to be embedded within the email body rather than being as a separate attachment.
The best way to implement the above requirement is to set an email based subscription for the report and configure the render format as MHTML. This would ensure that the report will be embedded within the body of the email
As per the above approach subscription is configured for the report as below

.

When the subscription got triggered the email obtained was as below
As you see from the above, the rendered report was stripped off its format settings when rendered in MHTML format
This would cause difficulty in interpreting the report especially when amount of data shown in the report is huge. Question was how to make sure the format remains intact while rendering through sunscription as above
I was able to arrive at the solution after some analysis. The solution is to use expression mode to set the format properties for the report cells
As an example see the below illustration
Once you set this as an expression and set it for subscription you can see the rendered report as below
As you see from the above the report gets rendered with all the format settings correctly applied. All the property values have been set using expressions in the report designer and MHTML format will preserve the values while rendering through the subscription.

Conclusion

As seen from the illustration above, the format properties of the report can be preserved intact by using expressions while rendering in MHTML format.

1 thought on “SSRS Tips : Fixing Format Issues in MHTML Rendered SSRS Reports

Comments are closed.