public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { PHT06 rpt = new PHT06(); rpt.Site = this.Site; return rpt; }
private void Export_pdf(DataTable dt_export, string branch_code, string type, string folderOut) { try { if (dt_export.Rows.Count > 0) { string file_path = folderOut.Trim() + branch_code.Trim() + "_" + type + "_" + dpFromDate.Text.Trim().Replace("/", "") + "_" + dpToDate.Text.Trim().Replace("/", "") + ".pdf"; PHT06 cry = new PHT06(); cry.SetDataSource(dt_export); string title = "DANH SÁCH THẺ ĐÃ PHÁT HÀNH, IN PIN"; cry.SetParameterValue("Title", title); cry.SetParameterValue("Fromdate", dpFromDate.Text.Trim()); cry.SetParameterValue("Todate", dpToDate.Text.Trim()); ExportOptions CrExportOptions; DiskFileDestinationOptions CrDiskFileDestinationOptions = new DiskFileDestinationOptions(); PdfRtfWordFormatOptions CrFormatTypeOptions = new PdfRtfWordFormatOptions(); CrDiskFileDestinationOptions.DiskFileName = file_path;// tbFilePath.Text.Trim() + "\\" + card_number.Trim() + ".pdf";//"c:\\csharp.net-informations.pdf"; CrExportOptions = cry.ExportOptions; { CrExportOptions.ExportDestinationType = ExportDestinationType.DiskFile; CrExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat; //CrExportOptions.ExportFormatType = ExportFormatType.WordForWindows; CrExportOptions.DestinationOptions = CrDiskFileDestinationOptions; CrExportOptions.FormatOptions = CrFormatTypeOptions; } cry.Export(); //--Fix for Load Report failse if (cry != null) { cry.Close(); cry.Dispose(); } } } catch (Exception ex) { //MessageBox.Show("Err Export_pdf: \n Branch: "+ branch_code +"\n" + ex.ToString()); string[] row = { branch_code, ex.ToString() }; dgv_err.Rows.Add(row); } }