如何在不进行水晶报告的情况下进行打印. [英] How to print without going to crystal report.
本文介绍了如何在不进行水晶报告的情况下进行打印.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经创建了Windows应用程序并完成了Crystal Report.单击打印"按钮时,我使用了打印"按钮,可以直接打印报表,而无需进入Crystal报表.
Hi,
I have create my a windows application and also finish crystal report.I have used a print button when i am clicking the print button the report is directly print without going to crystal report.
推荐答案
使用 PrintDocument [
Use a PrintDocument[^] - the link includes a simple example.
U可以这样使用
U can use like this
dim SqlStr as string
SqlStr = "Select * from Example"
ClsCrystalReportPrintOnly.ShowReport(Report,SqlStr,"ex.rpt")
Report.PrintOptions.PrinterName = "Example"
Report.Refresh()
Report.PrintToPrinter(1, False, 0, 0)
-包含名称为Report
的Crystal报表文档
上面的代码适用于VB点网
适用于C#点网
-- include a Crystal report document by name Report
the above code applies for VB dot net
for C# dot net
frmReport objReport = new frmReport();
dataset ds = "Select * from example";
ReportDocument cryRpt = new ReportDocument(); cryRpt.Load( "C:/Reports/Example.rpt");
ParameterValues crParameterValues = new ParameterValues();
ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue();
cryRpt.SetDataSource(ds.Tables[0]);
objReport.crystalReportViewer1.ReportSource = cryRpt;
objReport.crystalReportViewer1.Refresh();
clsCR.ApplyLogonToTables(cryRpt);
objReport.crystalReportViewer1.PrintReport();
这篇关于如何在不进行水晶报告的情况下进行打印.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文