我要打印一个报表,且只打印报表文件不打印页面代码如下:
ReportDocument rpDoc=new ReportDocument();
string path1,path2;
path1=Server.MapPath ("\\learn");//获取虚拟路径的真实路径,
path2=path1+"\\CrystalReport00.rpt";
rpDoc.Load(path2);// 重载
rpDoc.PrintOptions.PrinterName="\\\\192.168.1.4\\Samsung SF-555P";
rpDoc.PrintToPrinter(1,true,0,0);可这里我打印机名字使自己指定的,请问在客户端怎么让客户选择可用的打印机,
包括网络上的可用的打印机。最好能弹出一个设置的对话框。谢谢各位阿
ReportDocument rpDoc=new ReportDocument();
string path1,path2;
path1=Server.MapPath ("\\learn");//获取虚拟路径的真实路径,
path2=path1+"\\CrystalReport00.rpt";
rpDoc.Load(path2);// 重载
rpDoc.PrintOptions.PrinterName="\\\\192.168.1.4\\Samsung SF-555P";
rpDoc.PrintToPrinter(1,true,0,0);可这里我打印机名字使自己指定的,请问在客户端怎么让客户选择可用的打印机,
包括网络上的可用的打印机。最好能弹出一个设置的对话框。谢谢各位阿
解决方案 »
- ASP.net中面板的问题
- 以前问过的问题一直未有好的答案,就是用vs2005开发的c#Asp.net网站若.sln文件丢失了该如何恢复?
- 高手帮忙:url重写碰到的奇怪问题(紧急!!)
- 请问这段存储过程代码是否有问题??????????????????????????????
- 如何让asp.net与asp同时在一台电脑上运行?
- windows服务程序问题
- 屏蔽掉另存为事件
- 请问有谁知道国外有什么ASP。NET论坛是比较多人上的。
- asp.net怎么生成用代码生成静态网页
- 类库文件如何编译好?
- 跪求asp.net四级下拉框无刷新代码,数据库是SQL,急啊~!!!!
- 请问 如何真实的刷新Frame中的另一个窗口?
你最好用javascript弹出<center class="Noprint">
<p>
<OBJECT id="WebBrowser" classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" height="0"
width="0" VIEWASTEXT>
</OBJECT>
<input type="button" value="打印" onclick="document.all.WebBrowser.ExecWB(6,1)"> <input type="button" value="直接打印" onclick="document.all.WebBrowser.ExecWB(6,6)">
<input type="button" value="页面设置" onclick="document.all.WebBrowser.ExecWB(8,1)">
<input type="button" value="打印预览" onclick="document.all.WebBrowser.ExecWB(7,1)">
</p>
</center>
...
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
<style media="print">.Noprint { DISPLAY: none }
</style>
<script language="javascript" type="text/javascript">
</script>
<script>
function printsetup(){
// 页面设置
wb.execwb(8,1);
}
function printpreview(){
// 打印预览wb.execwb(7,1);
} function printit()
{
if (confirm('确定打印吗?')) {
wb.execwb(6,6)
}
}
</script>
</HEAD>
<body>
<OBJECT id="wb" height="0" width="0" classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"
name="wb" VIEWASTEXT>
</OBJECT>
<form id="Form1" method="post" runat="server">
... ...
<table class="noprint" style="HEIGHT: 24px" cellSpacing="0" cellPadding="0" width="850">
<tr align="center">
<td><asp:button id="prepage" runat="server" Text="上一页"></asp:button> <asp:button id="nextpage" runat="server" Text="下一页"></asp:button></td>
</tr>
</table>
<table style="FONT-SIZE: 10pt; HEIGHT: 24px" cellSpacing="0" cellPadding="0" width="850"
align="left">
<tr>
<td height="10"></td>
</tr>
<tr align="center">
<td><INPUT class="Noprint" id="print" style="WIDTH: 57px; HEIGHT: 24px" onclick="javascript:printit()"
type="button" value="打印">
</td>
</tr>
</table>
注意其中的class="Noprint",只要有了这句话,打印的时候就不打印出来了