Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to include inline (not linked) images in SSRS e-mail reports?

I have multiple SSRS 2008 report templates that contain embedded images and these are currently visible as expected in any report manager previews (using rendering extension HTML 4.0). However, I need these reports to be sent out as HTML e-mails.

I believe the basic/easiest technique here is to attach the images as inline base64 string to the image tags in the HTML. Is there a way to do this automatically in SSRS or alternatively what is the best practice to achieve this or similar result (i.e. images as attachments resulting in not-too-interoperable MHTML instead of pure HTML)?

The e-mail must be displayed as-is without connecting to any external storage (i.e. it's not feasible to host the images by the sender). Additionally we won't be using the SSRS itself to send the resulting HTML/e-mails so any restrictions of such nature are not of concern.

Example of the inline base64 I was thinking:

<img src="data:image/png;base64,xxxxxxxx==" alt="Some Image">
like image 783
allu Avatar asked Aug 17 '12 06:08

allu


1 Answers

It appears that the easiest way to achieve this is to modify or extend the rendering extension just a tiny bit as described in the MSDN documentation:

Writing Custom Rendering Extensions

Before you decide to create a custom rendering extension, you should evaluate simpler alternatives. You can:

  1. Create a modified version of an existing rendering extension.
  2. Customize rendered output by specifying device information settings for existing extensions.
  3. Add custom formatting and presentation features by combining XSL Transformations (XSLT) with the output of the XML rendering format.

Writing a custom rendering extension is difficult to do as well as to learn.. A rendering extension must typically support all possible combination of report elements. The report object model is extensive (the classes, interfaces, methods, and properties that you must implement number in the hundreds), and the documentation and samples are not yet at a level that can support you through a challenging development project.

If you must render a report in a format that is not included with Reporting Services, you can write your own managed code implementation of a rendering extension. The rendering extension code must implement the IRenderingExtension interface, which is required by the report server. Each of the rendering extensions implemented by Microsoft and shipped with Reporting Services uses a common set of interfaces. This ensures that each extension implements comparable functionality and reduces the complexity of the rendering code in the core of the report server.

like image 115
allu Avatar answered Oct 27 '22 10:10

allu