【问题标题】:How to use PrinttoPrinter in crystal report viewer and print on multiple printers?如何在水晶报表查看器中使用 PrinttoPrinter 并在多台打印机上打印?
【发布时间】:2020-06-07 03:04:38
【问题描述】:

我想在 c# windows 应用程序中直接打印到打印机,

我正在使用以下代码在屏幕上显示报告:

                int order_id = Convert.ToInt32(textorder.Text);
                RPT.OrdersReport report = new RPT.OrdersReport();
                RPT.RPT_TESTS frm = new RPT.RPT_TESTS();
                report.SetDataSource(order.GetOrderDetailsForPrint(order_id));
                frm.crystalReportViewer1.ReportSource = report;
                frm.ShowDialog();

如何更新我的代码以使用“打印到打印机”以及如何在多台打印机上打印还有 A4 打印机报告和标签打印机?

【问题讨论】:

    标签: c# crystal-reports


    【解决方案1】:

    要打印到打印机,请使用以下代码打印到默认打印机:

    int order_id = Convert.ToInt32(textOrder.Text);
    RPT.OrdersReport report = new RPT.OrdersReport();
    RPT.RPT_TESTS frm = new RPT.RPT_TESTS();
    report.SetDataSource(order.GetOrderDetailsForPrint(order_id));
    report.PrintToPrinter(1, true, 0, 0);
    

    要打印到第二台打印机,请使用以下代码:

    RPT.barcode myreport = new RPT.barcode();
    myreport.SetDatabaseLogon("User_Name", "Password");
    RPT.RPT_TESTS myform = new RPT.RPT_TESTS();
    myreport.PrintOptions.PrinterName = "Second Printer Name ";
    myreport.PrintToPrinter(1, true, 0, 0);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-09-15
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多