Modifying SSRS Report on Export

Recently a client asked to add a logo and disclamer to all reports. Well, reports are hosted in a custom portal, which already displays a logo and disclamer takes too much space.  Without thinking of consequences I expressed this oppenion and got stuck with implementing it.

I thought that Export button in the ReportViewer toolbar can be intercepted (like View report button) and was wrong.  Next option was to use JQuery and attach to the Export button on the client side.  Theere is an Export(<extension Name>) method that you can call on the ReportClient from Java Script, but there is no easy way of passing an additional parameter (the one that should control visibility of the auxiliary items).  When I say no easy way it means no way that I know about and can quickly figure out.

The next option was writing Custom Rendering Extension and was disourage by this quote from MSDN: “A rendering extension must typically support all possible combinations of report elements and requires that you implement hundreds of classes, interfaces, methods, and properties”.

The only option left was to replace Export in the ReportViewer toolbar with my custom, intercept rendering parameters, add the one that would tell to unhide the logo and disclamer and render the report in the desired format.  Not that difficult, but then I have to make these UI elements active when the report is rendered (more Java script code).  I started on this path and then I found ReportFormat.Name global veriable.

So all I have to do is to put client’s logo and disclaimer into a rectangle and set Visibility.Hidden to something like

(Globals!RenderFormat.Name != “EXCEL”)

That was easy!

 

 

Posted on by tiramesu

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>