我要打印一个报表,且只打印报表文件不打印页面代码如下:
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);可这里我打印机名字使自己指定的,请问在客户端怎么让客户选择可用的打印机,
包括网络上的可用的打印机。最好能弹出一个设置的对话框。谢谢各位阿

解决方案 »

  1.   

    水晶报表(9)好像弹不出来设置对话框
    你最好用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>
      

  2.   

    设个noprint的style不就行了?把不想打印的放上.noprint,不就想打印什么就打印什么了?
    ...
    <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>&nbsp;&nbsp;&nbsp;&nbsp;<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",只要有了这句话,打印的时候就不打印出来了