水晶报表直接打印问题
现在我做的方式是用报表查看器 方法如下:
hzb.SetDataSource(tb_0); //绑定数据源
this.crystalReportViewer1.ReportSource = hzb;
((CrystalDecisions.CrystalReports.Engine.TextObject)hzb.Section1.ReportObjects["ksrq"]).Text = ksrq;//动态改变报表字段值
现在要求直接打印 不预览 也不显示打印机设置窗体 网上方法如下
ReportDocument myReport = new ReportDocument();
string reportPath = Server.MapPath("crystalreport1.rpt");
myReport.Load(reportPath); //报表路径
myReport.PrinttoPrinter(1,false,0,0);
可这种方法加载报表是用的路径 我上面用的方法是实例化的 打包程序不发布报表文件,如何解决