Pages

Saturday, October 18, 2008

Disabling some file export options in Reporting Service

There are some options available in Reporting services to export reports.

If you want to disable few options from that list into all application on your server then you can make it visible false by editing one central config file named "rsreportserver.config"

You need to make visible false which ever extension you don't want in the list of export report.

But if you want to make this for only one particular application then you can write down below code into your application:

private void DisableUnwantedExportFormats()
{
foreach (RenderingExtension extension in ReportViewer1.ServerReport.ListRenderingExtensions())
{
if (extension.Name == "XML" || extension.Name == "IMAGE" || extension.Name == "MHTML"
|| extension.Name == "PDF" || extension.Name =="RGDI" || extension.Name == "XLTemplate"
|| extension.Name == "WordTemplate" || extension.Name == "HTML4.0" || extension.Name == "HTML3.2")
{
FieldInfo info = extension.GetType().GetField("m_serverExtension", BindingFlags.NonPublic |     BindingFlags.Instance);
if (info != null)
{
Extension rsExtension = info.GetValue(extension) as Extension;
if (rsExtension != null)
{
rsExtension.Visible = false;
}
}
}
}
}

No comments:

Post a Comment