其他分享
首页 > 其他分享> > 水晶报表导出pdf文件

水晶报表导出pdf文件

作者:互联网

/// <summary>
/// 导出pdf文件
/// </summary>
/// <param name="mjsReport">报表文件数据(取 crystalReportViewer1.ReportSource = rp中rp的值)</param>
/// <param name="reportFileName">导出文件名称,例如:111.pdf</param>
private void pdfExport(ReportDocument mjsReport, string reportFileName)
{
try
{
SaveFileDialog SaveFileDialog1 = new SaveFileDialog();
ExportOptions mjsReportExportOptions = new ExportOptions();
mjsReportExportOptions = mjsReport.ExportOptions;
mjsReportExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat; SaveFileDialog1.Filter = "Report Files (*.pdf)|*.pdf"; reportFileName = AppDomain.CurrentDomain.BaseDirectory + "\\pdfExport\\"+ reportFileName; if (!string.IsNullOrEmpty(reportFileName)) { mjsReport.ExportToDisk(ExportFormatType.PortableDocFormat, reportFileName); } } catch (Exception ex) { LogWrite.AddLgoToTXT("pdfExport异常反参:" + ex.Message); } }

  

标签:报表,导出,reportFileName,ExportOptions,mjsReportExportOptions,pdf,ExportFormatType,m
来源: https://www.cnblogs.com/lydj/p/16473328.html