SSRS - Disabling export options (eg. PDF) for individual reports

后端 未结 8 1188
清酒与你
清酒与你 2020-12-09 17:46

We have many reports which we use on the website. While exporting some reports as PDF, the file size gets huge and the server crashes due to load. So it would be great if I

相关标签:
8条回答
  • 2020-12-09 18:23

    You can use Pre_render event in Report Viewer.

      protected void ReportViewer1_PreRender(object sender, EventArgs e)
            {
                DisableUnwantedExportFormat((ReportViewer)sender, "Excel");
                DisableUnwantedExportFormat((ReportViewer)sender, "Word");
            } 
    

    Take a look at this post

    Example Remove save As in SSRS

    0 讨论(0)
  • 2020-12-09 18:23

    You can hide PDF button globally in a specific config file here:

    "InstallPath\Reporting Services\ReportServer\rsreportserver.config"

    For more information, there is already a topic about this on StackOverflow.

    Please check for more answers here: ReportViewer - Hide PDF Export

    0 讨论(0)
  • 2020-12-09 18:23

    The question is not new, but maybe for others with same problem, My answer be useful, too. In web.config => configuration => configSectionssection paste a new config for telerik report, if you don't have:

    <section
          name="Telerik.Reporting"
          type="Telerik.Reporting.Configuration.ReportingConfigurationSection, Telerik.Reporting, Version=11.0.17.118, Culture=neutral, PublicKeyToken=a9d7983dfcc261be"
          allowLocation="true"
          allowDefinition="Everywhere"/>
    

    Use your telerik verion in version attribute. you can find it from Solution Explorer => your project name => References => TelerikReporting => Properties And Also, in <configrations> body, paste:

     <Telerik.Reporting>
    <extensions>
      <render>
        <extension name="RTF" visible="false">
        </extension>
        <extension name="PDF" visible="false">
        </extension>
        <extension name="CSV" visible="false">
        </extension>
        <extension name="IMAGE" visible="false">
        </extension>
        <extension name="MHTML" visible="false">
        </extension>
        <extension name="XPS" visible="false">
        </extension>
      </render>
    </extensions>
      </Telerik.Reporting>
    

    In code above I disabled any export type, except for Excel.

    0 讨论(0)
  • 2020-12-09 18:25

    My solution for this

    $(document).ready(function() {
            var sel = $("select#ReportViewer2_ctl01_ctl05_ctl00");
            sel.find("option[value='XML']").remove();
            sel.find("option[value='CSV']").remove();
            sel.find("option[value='IMAGE']").remove();
            sel.find("option[value='MHTML']").remove();
            sel.find("option[value='PDF']").remove();
            sel.find("option[value='EXCEL']").remove();
    });
    
    0 讨论(0)
  • 2020-12-09 18:27

    This solves the problem (partially for us):

    http://social.msdn.microsoft.com/Forums/en-US/sqlreportingservices/thread/0c680c69-9f7d-42aa-a6b4-b1178eab8adf

    0 讨论(0)
  • 2020-12-09 18:32

    Just in case nobody else said it out loud before here or in linked articles:

    The neatiest global solution is to find the rendering engines in the RS config file (mine sits in: C:\Program Files\Microsoft SQL Server\MSRS12.MSSQLSERVER\Reporting Services\ReportServer\rsreportserver.config), go to xml key: Extensions > Render and insert following property at the end of each entry you want to hide:

    Visible="false"

    Example:

    <Extension Name="XML" Type="Microsoft.ReportingServices.Rendering.DataRenderer.XmlDataReport,Microsoft.ReportingServices.DataRendering" Visible="false"/>

    Alternatively put <!-- and --> (HTML comment markers) at the beginning and end of the entry.

    For individual reports those functions will do the trick.

    0 讨论(0)
提交回复
热议问题