private void barPrintPPE_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { tag = 2; bool canSave = (DialogResult.OK == MessageBox.Show("是否將打印文件上傳至服務器(pdf格式)", "操作提示", MessageBoxButtons.OKCancel)); ANSI2015RO r = new ANSI2015RO(this._PCExportReportANSI, tag); //r.ShowPreviewDialog(); if (canSave) { if (this._PCExportReportANSI != null && !string.IsNullOrEmpty(this._PCExportReportANSI.ExportReportId)) { string sfdir = this._ServerSavePath + "\\" + this._PCExportReportANSI.ExportReportId; try { System.IO.Directory.CreateDirectory(sfdir); r.ExportToPdf(sfdir + "\\" + this._PCExportReportANSI.ExportReportId + ".pdf"); MessageBox.Show("文件已導出為pdf格式上傳至服務器"); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } } r.ShowPreviewDialog(); }
//列印 protected override DevExpress.XtraReports.UI.XtraReport GetReport() { tag = 0; bool canSave = (DialogResult.OK == MessageBox.Show("是否將打印文件上傳至服務器(pdf格式)", "操作提示", MessageBoxButtons.OKCancel)); ANSI2015RO r = new ANSI2015RO(this._PCExportReportANSI, tag); //r.ShowPreviewDialog(); if (canSave) { if (this._PCExportReportANSI != null && !string.IsNullOrEmpty(this._PCExportReportANSI.ExportReportId)) { string sfdir = this._ServerSavePath + "\\" + this._PCExportReportANSI.ExportReportId; try { System.IO.Directory.CreateDirectory(sfdir); r.ExportToPdf(sfdir + "\\" + this._PCExportReportANSI.ExportReportId + ".pdf"); MessageBox.Show("文件已導出為pdf格式上傳至服務器"); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } } return(r); }