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

后端 未结 8 1189
清酒与你
清酒与你 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:41

    You can use a div over that save button and set its properties like below

    <div style="
        background-color: white;
        z-index: 100;
        height: 61px;
        position: absolute;
        padding-left: 500;
        padding-left: 36px;
        margin-left: 370px;
        opacity: 0.5;
    "></div> 
    
    0 讨论(0)
  • 2020-12-09 18:42

    I was using the MvcReportViewer library to get SSRS's report viewer in our MVC application. The library does not support User Control lifecycle events, so I was not able to use the PreRender method given by shamcs. The Javascript method described by Ristanovic Marko partially works, but the selectors did not work for the version of SSRS we were using, it requires JQuery to be loaded in the IFrame, and it does not describe a way to do this only for specific reports. Here's what I came up with:

    In my ReportViewer partial, I added the following script block:

    var frame = $('#reportframe');
    var src = frame.attr('src');
    frame.attr('src', src + '?showAdditionalExports=' + @ViewBag.ShowExportsAttribute);
    

    In ReportViewerWebForm.aspx, I added another script block:

    var urlParams = new URLSearchParams(location.search);
    if (urlParams.get('showAdditionalExports') === 'true') {
        document.addEventListener("DOMContentLoaded",
            function() {
                ['Word', 'Excel'].map(function(title) {
                    var menuItem = document.querySelector("#ReportViewer1 a[title='" + title + "']")
                        .parentNode;
                    menuItem.parentNode
                        .removeChild(menuItem);
                });
            });
        }
    
    0 讨论(0)
提交回复
热议问题