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 in Uncategorized | Leave a comment

Asynchronous

[DebuggerStepThrough]

public static Task SimpleBodyAsync() {

<SimpleBodyAsync>d__0 d__ = new <SimpleBodyAsync>d__0();

d__.<>t__builder = AsyncTaskMethodBuilder.Create();

d__.MoveNext();

return d__.<>t__builder.Task;

}

[CompilerGenerated]

[StructLayout(LayoutKind.Sequential)]

private struct <SimpleBodyAsync>d__0 : <>t__IStateMachine {

private int <>1__state;

public AsyncTaskMethodBuilder <>t__builder;

public Action <>t__MoveNextDelegate;

 

public void MoveNext() {

try {

if (this.<>1__state == -1) return;

Console.WriteLine(“Hello, Async World!”);

}

catch (Exception e) {

this.<>1__state = -1;

this.<>t__builder.SetException(e);

return;

}

 

this.<>1__state = -1;

this.<>t__builder.SetResult();

}

}

Posted in Uncategorized | Leave a comment

.NET Authorization

<allow   (or <deny)
   users="comma-separated list of users"
   roles="comma-separated list of roles"
   verbs="comma-separated list of verbs"
/>
Two special identities:
* Refers to all identities
? Refers to the anonymous identity
Typical scenario, when you need to allow some roles, but not any authenticated users you will write: <allow roles="someusers, administrators"/> <deny users="*" />
The order in which those elements appear determines the inportance.
In the example above although all users are denied access by deny *,
someusers and administrators will still have access,
because corresppopnding allow was placed above deny.
Posted in Uncategorized | 3 Comments