Asp.net

SQL Reporting Services - Mozilla 中未顯示列印按鈕

  • May 26, 2016

我正在使用SQL Reporting services ,它執行良好,並在IE中顯示列印按鈕,但在 Mozilla Firefox 中未顯示。

有人有什麼主意嗎?

我已經檢查了這個解決方案,但它不起作用:

http://social.msdn.microsoft.com/Forums/en-US/vsreportcontrols/thread/7bdf431d-70db-419d-8e98-ef41cad8e2d8

我不認為它使用 ActiveX,因為在表 onclick 事件中有一個簡單的:

ReportFramerpvReport.GetReportFrame().contentWindow.print()

無論如何,我用我自己的列印功能替換了這個列印的東西,因為上面的程式碼在 FF 上不起作用。

我知道這很醜……但它有效!(只需將 ControlName 值替換為您的 ControlID 並確保在您的頁面中添加 jQuery 庫)

   $(document).ready(function()
   {
       if ($.browser.mozilla)
       {
           try
           {
               var ControlName = 'RptDespesas';
               var innerScript = '<scr' + 'ipt type="text/javascript">document.getElementById("' + ControlName + '_print").Controller = new ReportViewerHoverButton("' + ControlName + '_print", false, "", "", "", "#ECE9D8", "#DDEEF7", "#99BBE2", "1px #ECE9D8 Solid", "1px #336699 Solid", "1px #336699 Solid");</scr' + 'ipt>';
               var innerTbody = '<tbody><tr><td><input type="image" style="border-width: 0px; padding: 2px; height: 16px; width: 16px;" alt="Print" src="/Reserved.ReportViewerWebControl.axd?OpType=Resource&Version=9.0.30729.1&Name=Microsoft.Reporting.WebForms.Icons.Print.gif" title="Print"></td></tr></tbody>';
               var innerTable = '<table title="Print" onmouseout="this.Controller.OnNormal();" onmouseover="this.Controller.OnHover();" onclick="PrintFunc(\'' + ControlName + '\'); return false;" id="' + ControlName + '_print" style="border: 1px solid rgb(236, 233, 216); background-color: rgb(236, 233, 216); cursor: default;">' + innerScript + innerTbody + '</table>'
               var outerScript = '<scr' + 'ipt type="text/javascript">document.getElementById("' + ControlName + '_print").Controller.OnNormal();</scr' + 'ipt>';
               var outerDiv = '<div style="display: inline; font-size: 8pt; height: 30px;" class=" "><table cellspacing="0" cellpadding="0" style="display: inline;"><tbody><tr><td height="28px">' + innerTable + outerScript + '</td></tr></tbody></table></div>';

               $("#" + ControlName + " > div > div").append(outerDiv);

           }
           catch (e) { alert(e); }
       }
   });

   function PrintFunc(ControlName)
   {
       setTimeout('ReportFrame' + ControlName + '.print();', 100);
   }

引用自:https://stackoverflow.com/questions/951009