Sunday, October 11, 2015

How to change Rendering Extensions in SQL Server Reporting Services ?

SQL Server Reporting Services provides many different rendering extensions. Our users don't want to see the list of all rendering extensions, they only want to see Excel and PDF rendering extensions. How can you enable or disable Rendering Extensions in SQL Server Reporting Services Report Manager?


Problem
SQL Server Reporting Services provides many different rendering extensions. Our users don't want to see the list of all rendering extensions, they only want to see Excel and PDF rendering extensions. How can you enable or disable Rendering Extensions in SQL Server Reporting Services Report Manager?
Solution
This tip assumes that you have previous experience with SQL Server Reporting Services. In this tip I will explain the problem with an example and later demonstrate the solution. To demonstrate the solution I will use SQL Server 2012 Reporting Services.

Step 1: Looking at available SSRS rendering extensions

Let's run a sample report in Report Manager and then click on the export button to view the available rendering extensions. As you can see from the below image, it lists all available rendering extensions.
Report_Preview_Shows_All_Rendering_Extensions
Now from the available rendering extensions, I have to remove all of the unwanted rendering extensions except "Excel" and "PDF".

Step 2: Change the Reporting Services Rendering Extensions

The SQL Server Reporting Services rendering extensions are managed through the configuration file "RSReportServer.config". You can find this configuration file in the "ReportServer" folder. The complete path of the folder is C:\Program Files (x86)\Microsoft SQL Server\MSRS11.MSSQLSERVER\Reporting Services\ReportServer. Your configuration folder location may be slightly different. You can refer to the below image.
RSReportServer_Configuration_File
Open the "RSReportServer.config" file in Notepad and search for the node name, you can find all available rendering extensions there. You can refer to the below image which shows the code for the first two rendering extensions "XML" and "NULL".
I have highlighted each extension with a different border color. If you look at the second set of code ("NULL" Extension) then you will find the visible attribute is set to false, but for the first code set ("XML" Extension) this attribute is missing. Based on the visible attribute value rendering extensions will be displayed in the drop down list. If thevisible attribute value is false then the rendering extension will not be displayed in the drop down list or if the visibleattribute is missing or has a value of true then the rendering extension will be displayed in the drop down list.
As you can see in the below image for the "NULL" rendering extension the visible attribute value is false that is why "NULL" rendering extension was not available in the rendering extension drop down list.
Open_RSReportServer_Configuration_File_Notepad
(Note- Be careful when changing the report server configuration file; it is recommended to create a back-up of the RSReportServer.config file before modification.)
If we add an attribute Visible="false" for the "XML" rendering extension then it should not show in the rendering extension drop down list. Let's add an attribute Visible="false" for the "XML" rendering extension, after the changes the file should look like below.
RSReportServer_Configuration_File_After_Modification

Step 3: Re-checking Available Rendering Extensions after the above changes

Let's run the sample report again and click on the export button to view the available export formats after the modification. As you can see from the below image, the "XML" rendering extension has been removed from the drop down list.
Report_Preview_Shows_Desired_Rendering_Extensions
In this same way we can remove all of the unwanted rendering extensions from the drop down list. After we add an attribute Visible="false" for all of the unwanted rendering extensions except "Excel" and "PDF" the list looks like follows.
Only_PDF_Excel_Rendering_Options

Step 4: Checking Available Rendering Extensions in report subscription setup page

Let's go to the report subscription setup page and check available rendering extensions. As you can see from the below image, it lists all available rendering extensions. You are probably surprised to see that all rendering extensions are here even after modifying the "RSReportServer.config" file. So how can we remove the unwanted rendering extensions from here?
Report_Subscription_Rendering_Extensions
I mentioned that "RSReportServer.config" is the only file which manages rendering extensions. As you know we have already modified the "RSReportServer.config" file, but these changes are not taking effect. If you want to remove the rendering extension from this section too, you will have to delete the rendering extension code from the "RSReportServer.config" file. Deleting the extension code will remove the rendering extension from all rendering extension drop down lists including the subscription page.
I have removed the "XML" extension code from the "RSReportServer.config" file. The below line is what I removed.
<Extension Name="XML" Type="Microsoft.ReportingServices.Rendering.DataRenderer.XmlDataReport,
Microsoft.ReportingServices.DataRendering" Visible="false"/> 
Let's check the available rendering extensions in the Report Subscription page. As you can see from the below image, the "XML" rendering extension has been removed from the drop down list.
Report_Subscription_Required_Rendering_Extensions
In the same way, you can disable all unwanted rendering extensions from the "RSReportServer.config file.
To enable rendering extensions, do the opposite and add the code back.