簡體   English   中英

如何在水晶報表查看器中使用 PrinttoPrinter 並在多台打印機上打印?

[英]How to use PrinttoPrinter in crystal report viewer and print on multiple printers?

我想在 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 打印機報告和 Label 打印機?

要打印到打印機,請使用以下代碼打印到默認打印機:

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);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM