打印报告而不显示打印对话框 [英] Print a Report without Showing Print Dialog Box

查看:87
本文介绍了打印报告而不显示打印对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在不提示打印对话框的情况下打印报告?

有没有办法绕过打印对话框?



感谢您的帮助。







用户未指定,平台。无论是Win Forms还是ASP.Net Page

解决方案

您使用的是ASP.Net还是WinForms?



如果您想要ASP.Net的解决方案,请尝试以下链接。 (它仅适用于Internet Explorer)



在MSDN上 [ ^ ]



在Devx上 [ ^ ]


 <   script     language   =  vbscript >  
子打印()
OLECMDID_PRINT = 6
OLECMDEXECOPT_DONTPROMPTUSER = 2
OLECMDEXECOPT_PROMPTUSER = 1
致电WB.ExecW B(OLECMDID_PRINT,OLECMDEXECOPT_DONTPROMPTUSER,1)
End Sub
document.write< object ID =' WB' WIDTH = 0 HEIGHT = 0 CLASSID =' < span class =code-keyword> CLSID:8856F961-340A-11D0-A96B-00C04FD705A2' > < / object >
< / script >

< / head >
< body >
< form id = form1 runat = 服务器 >
< div >
< a href = javascript:window.print(); > 打印< / a > < / div >
< / form >
< / body >


How can I print a report without prompting for Print Dialog Box ?
Is there any way to bypass the Print Dialog Box ?

Thanks for your Help.



User has not specified, the platform. Whether it is Win Forms or ASP.Net Page

解决方案

Are you using ASP.Net or WinForms ?

If you want the solution for ASP.Net, then try following links. (It only works in Internet Explorer)

On MSDN[^]

On Devx[^]


<script language="vbscript">
Sub Print()
       OLECMDID_PRINT = 6
       OLECMDEXECOPT_DONTPROMPTUSER = 2
       OLECMDEXECOPT_PROMPTUSER = 1
       call WB.ExecWB(OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER,1)
End Sub
document.write "<object ID='WB' WIDTH=0 HEIGHT=0 CLASSID='CLSID:8856F961-340A-11D0-A96B-00C04FD705A2'></object>"
</script>

</head>
<body>
    <form id="form1" runat="server">
    <div>
    <a href="javascript:window.print();">Print</a> </div>
    </form>
</body>


这篇关于打印报告而不显示打印对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆