本文介绍了如何申报否。要打印的副本(DevExpress XtraReport)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

给出以下代码从DevExpress XtraReport组件打印报告:



Given the following code that prints a report from the DevExpress XtraReport component:

XtraReport1 report = new XtraReport1();
            using (ReportPrintTool printTool = new ReportPrintTool(report))            {
                printTool.PrintDialog();
                printTool.Print();
                printTool.Print("HP LaserJet Professional P1606dn");
            }





我如何/在哪里指定要打印的份数?



How / where can I specify the number of copies to print?

推荐答案

private void button1_Click(object sender, System.EventArgs e) {
     XtraReport1 report = new XtraReport1();
     report.PrintingSystem.StartPrint += new DevExpress.XtraPrinting.PrintDocumentEventHandler(PrintingSystem_StartPrint);
     report.Print();
}

private void PrintingSystem_StartPrint(object sender, DevExpress.XtraPrinting.PrintDocumentEventArgs e) {
     e.PrintDocument.PrinterSettings.Copies = 2; }


...
XtraReport1 report = new XtraReport1();
using (ReportPrintTool printTool = new ReportPrintTool(report))            
{
   printTool.PrintingSystem.StartPrint += StartPrint; // set Eventhandler

   printTool.PrintDialog();
   printTool.Print();
   printTool.Print("HP LaserJet Professional P1606dn");
}
...

private void StartPrint(object sender, PrintDocumentEventArgs e)
{
   e.PrintDocument.PrinterSettings.Copies = 3; // set Copies
}


这篇关于如何申报否。要打印的副本(DevExpress XtraReport)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-24 12:54