我正在使用 Reporting Services 制作报告,并尝试使用我找到的脚本将其从 html 文件直接打印到默认打印机:
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Untitled Page</title>
</head>
<BODY onload="Print()">
<object id="RSClientPrint" classid="CLSID:5554DCB0-700B-498D-9B58-4E40E5814405"
codebase="C:\\Program Files\\Microsoft SQL Server\\MSRS11.MSSQLSERVER\\Reporting Services\\ReportServer\\bin\\RSClientPrint-x86.cab#Version=1,0,0,0"
viewastext></object>
<script language="javascript">
function Print(){
RSClientPrint.MarginLeft = 12.7;
RSClientPrint.MarginTop = 12.7;
RSClientPrint.MarginRight = 12.7;
RSClientPrint.MarginBottom = 12.7;
RSClientPrint.Culture = 1033;
RSClientPrint.UICulture = 9;
RSClientPrint.Print('http://localhost/ReportServer', '/Pages/ReportViewer.aspx?%2fInventario%2fReport1&rs:Command=Render', 'Report1')
}
</script>
</BODY>
</html>
但是当我执行该文件时,我收到此错误:
Uncaught TypeError: RSClientPrint.Print is not a function
at Print (index.html:21)
at onload (index.html:5)
有人可以帮我解决这个问题吗...?
编辑 1
在 Internet Explorer 上它运行得很好......!!也许有一种方法可以让它在 Chrome 或 Firefox 上工作......
最佳答案
在 2016 年之前的报表服务中,打印控件是 Active-X,仅适用于 Internet Explorer。
对于其他浏览器,您必须导出为 PDF 或 Excel 并从应用程序打印。
您还可以使报表在一页中呈现并直接从浏览器打印(不建议)
关于javascript - Reporting Services - RSClientPrint.Print 不是函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41836841/