a729815303 发表于 2014-10-14 11:43:00

ActiveReport 可以跳过打印预览也跳过打印机选择直接打印吗?

ActiveReport 可以跳过打印预览也跳过打印机选择直接打印吗?

zl906310 发表于 2014-10-14 18:02:00

回复 1楼a729815303的帖子

Private Sub btnPrint()      
    Load rptInvoice   
   rptInvoice.dcRptData.RecordSource = "SELECT * FROM Invoices " & " WHERE OrderID= "& Str(lSelectedOrder)      
   rptInvoice.PrintReport False      
   Unload rptInvoice
End Sub

iceman 发表于 2014-10-14 18:21:00

回复 1楼a729815303的帖子

测试代码如下:

            PageReport pr = new PageReport(new FileInfo(Path.Combine(Application.StartupPath, "..\\..\\PageReport1.rdlx")));
            pr.Document.Printer.PrinterName = "Microsoft XPS Document Writer";
            pr.Document.Printer.Landscape = true;
            pr.Run();
            pr.Document.Print(false,false,false);

a729815303 发表于 2014-10-17 10:56:00

感谢

iceman 发表于 2014-10-17 12:07:00

回复 4楼a729815303的帖子

:mj72:

为了给你提供更优质的服务,请对本次服务进行评分。我们会认真对待你提出的宝贵意见,谢谢http://gcdn.gcpowertools.com.cn/attachment.aspx?attachmentid=10062

qakmak 发表于 2014-10-18 18:01:00

版主, 那如果是在HTML上呢?有个打印按钮. 用JS吗? 还是?
貌似您提供的代码是直接是C/S模式的客户端工具上执行的吧?

iceman 发表于 2014-10-20 17:03:00

回复 6楼qakmak的帖子

是服务端代码,可以通过 Server Button 的 Click 事件来调用3#代码,无法通过javascript代码指定打印机,谢谢

测试代码:

      protected void Button2_Click(object sender, EventArgs e)
      {
            PageReport pr = new PageReport(new FileInfo(this.Server.MapPath("PageReport1.rdlx")));
            pr.Document.Printer.PrinterName = "Microsoft XPS Document Writer";
            pr.Document.Printer.Landscape = true;
            pr.Run();
            pr.Document.Printer.Print();
      }



为了给你提供更优质的服务,请对本次服务进行评分。我们会认真对待你提出的宝贵意见,谢谢http://gcdn.gcpowertools.com.cn/attachment.aspx?attachmentid=10062

ALM_LongTime 发表于 2019-3-30 17:21:44

在WPF里应该怎么做呢 ?

KearneyKang 发表于 2019-4-1 09:56:11


WPF也是一样的,直接使用该代码实现静默打印就行。

KearneyKang 发表于 2019-4-1 09:56:13


WPF也是一样的,直接使用该代码实现静默打印就行。
页: [1]
查看完整版本: ActiveReport 可以跳过打印预览也跳过打印机选择直接打印吗?