void printMethod(string SendNo) { Report.ReportTable4 report = new Report.ReportTable4(); report.sp_SelectPrintSendInfoTableAdapter.Fill(report.printSendInfo_SP1.sp_SelectPrintSendInfo, SendNo); MainPreview.Model = new XtraReportPreviewModel(report); var model = visaORM.SendInfo.FirstOrDefault(s => s.FSendNo == SendNo); if (model != null) { report.xrLabelDSN.Text = model.FDSN; report.xrLabelComapny.Text = model.FVietnamCompany; } else { report.xrLabelDSN.Text = ""; report.xrLabelComapny.Text = ""; } report.xrLabelCaption.Text = "表格四"; DevExpress.XtraReports.UI.ReportPrintTool pt = new DevExpress.XtraReports.UI.ReportPrintTool(report); pt.Print(); }
void InitPreview(string SendNo) { try { Report.ReportTable4 report = new Report.ReportTable4(); report.sp_SelectPrintSendInfoTableAdapter.Fill(report.printSendInfo_SP1.sp_SelectPrintSendInfo, SendNo); MainPreview.Model = new XtraReportPreviewModel(report); var model = visaORM.SendInfo.FirstOrDefault(s => s.FSendNo == SendNo); if (model != null) { report.xrLabelDSN.Text = model.FDSN; report.xrLabelComapny.Text = model.FVietnamCompany; } else { report.xrLabelDSN.Text = ""; report.xrLabelComapny.Text = ""; } report.xrLabelCaption.Text = txtReportTitle.Text; MainPreview.Model = new XtraReportPreviewModel(report); report.CreateDocument(); } catch (System.Exception ex) { MessageBox.Show(ex.Message); Log.WriteLog.WriteErorrLog(ex); } }