Click here to Skip to main content
15,887,027 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
This one has been stumping me for a few months now, occasionally working on it from time to time and having no luck.

We use SSRS 2008 R2, and had a GPO in place to auto-install the ActiveX control for the default print button on the SSRS ribbon (rsclientprint). That GPO worked for almost a year, when suddenly the clients are being prompted to install that control again, asking for admin rights - CLSID {BDB57FF2-79B9-4205-9447-F5FE85F37312} when the report is hosted on the web server. When the exact same report is ran on the SQL Server using the same methods to retrieve the report, the GPO is in effect and auto-installs the control. All FQDN's have been added into the GPO for authorized sites. So...... I've decided to hide the Print button, and create my own without using code-behind until I figure out why the GPO stopped working correctly.

This is what I have so far that has made the most progress in my workaround:
C++
</head>
<body>
    <form id="form1" runat="server">

    <asp:Label ID="rptName" runat="server"></asp:Label>
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <rsweb:ReportViewer ID="ReportViewer1"  runat="server" Width="100%" Height="700px" AsyncRendering="false" ProcessingMode="Remote">
        <ServerReport ReportPath="/Test/NewECommerce/Consumption" ReportServerUrl="http://webserver/Test_ReportServer" />              
    </rsweb:ReportViewer>


<input type="Button" value="Print this Report" onclick="javascript:printReport();" />

<script language="javascript">
function printReport() {
             var viewerReference = $find("ReportViewer1");
             var stillonLoadState = clientViewer.get_isLoading();
             if (!stillonLoadState ) { 
                 var reportArea = viewerReference .get_reportAreaContentType(); 
                 if (reportArea == Microsoft.Reporting.WebFormsClient.ReportAreaContent.ReportPage) { 
                     $find("ReportViewer1").invokePrintDialog();
                     } 
             } 
        } 
</script>

    </form>

</body>
</html>


This will bring up the Windows Print Dialog, but the report printed is the grid table itself without any header info or data in the cells. Am I calling/querying the report incorrectly? Or is there a better, more effective way of creating a functional Print Button for the active report? Also, will this method work for a multiple-page report, or just the first page of results?
Posted

1 solution

I think that will not work because rendering the report to HTML format for printing purposes might carry future headaches and you know, each browser has its own rendering engine that adds more problems to this scenario. My suggestion is you go for the PDF approach as is stated here but instead of using that solution, you could embed some javascript print function into the PDF file using PDFSharp (http://stackoverflow.com/a/17732531[^]) to get it printed directly when the file is opened. With this approach you avoid ActiveX and the printing should work with other browsers not just with IE.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900