如何将crystalreoprtviewer发送到直接打印

如何将crystalreoprtviewer发送到直接打印

问题描述:

我有以下代码

frmPreviewReports Preview = new frmPreviewReports();   //This form contain report viewer   (line 1)
SalesInvoice SInvoice = new SalesInvoice();   //this is the report document (line2) 
Preview.RptViewer.ReportSource = SInvoice (line 3)

Preview.Show(); // this preview the report  (line 4)
Preview.RptViewer.PrintReport();  // this prompt the printing dialog  (line 5)


但我想将报告发送为直接打印,而没有提示打印对话框.
我的意思是(将一行替换为第4行)


but I would like to send the report to direct print without prompt printing dialog.
I mean (replace a single line to line 4)

How to do this ?

CrystalDecisions.CrystalReports.Engine.ReportDocument report = new CrystalDecisions.CrystalReports.Engine.ReportDocument();// this is the object of ReportDodument

    string repName = string.Empty;

    repName = CrystalReportSource1.ReportDocument.FileName;//put here your SalesInvoice with its Namespace.SalesInvoice

    report.Load(repName); 

    report.PrintToPrinter(1, false, 0, 0); 



它会将您的报告文档直接发送到打印机,而不会看到它.

希望对您有帮助...



It will send your report document direct to the printer without seeing it.

Hope it will help...