Muh*_*tar 14 asp.net firefox reporting-services
我正在使用SQL Reporting服务,它运行良好并在IE中显示一个打印按钮,但在Mozilla Firefox中没有显示.
有谁有想法吗?
我已经检查了这个解决方案,但它没有工作:
Isr*_*uez 11
我不认为它使用ActiveX,因为在表onclick事件中有一个简单的:
ReportFramerpvReport.GetReportFrame().contentWindow.print()
Run Code Online (Sandbox Code Playgroud)
无论如何,我用我自己的打印功能替换了这个打印的东西,因为上面的代码不适用于FF ..
我知道这很难看......但它确实有效!(只需用ControlID替换ControlName值,并确保在页面中添加jQuery lib)
$(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);
}
Run Code Online (Sandbox Code Playgroud)
小智 5
上面的解决方案对我不起作用,因此在检查了呈现的html之后,我对上面的解决方案进行了以下更改。
ReportViewerGeneral_ctl05- >寻呼机的ID
VisibleReportContentReportViewerGeneral_ctl09- >包含报告结果的div的ID。
pageLoad- >参考此
function pageLoad() {
if ($.browser.mozilla && !$("#ff_print").length) {
try {
var ControlName = 'ReportViewerGeneral';
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" onclick="PrintFunc(\'' + ControlName + '\'); return false;" id="ff_print" style="border: 1px solid rgb(236, 233, 216); background-color: rgb(236, 233, 216); cursor: default;">' + innerTbody + '</table>'
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 + '</td></tr></tbody></table></div>';
$("#ReportViewerGeneral_ctl05 > div").append(outerDiv);
}
catch (e) { alert(e); }
}
}
function PrintFunc() {
var strFrameName = ("printer-" + (new Date()).getTime());
var jFrame = $("<iframe name='" + strFrameName + "'>");
jFrame
.css("width", "1px")
.css("height", "1px")
.css("position", "absolute")
.css("left", "-2000px")
.appendTo($("body:first"));
var objFrame = window.frames[strFrameName];
var objDoc = objFrame.document;
var jStyleDiv = $("<div>").append($("style").clone());
objDoc.open();
objDoc.write($("head").html());
objDoc.write($("#VisibleReportContentReportViewerGeneral_ctl09").html());
objDoc.close();
objFrame.print();
setTimeout(function () { jFrame.remove(); }, (60 * 1000));
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
60810 次 |
| 最近记录: |