水晶报表导出pdf文件
阅读原文时间:2023年07月09日阅读:1

///

/// 导出pdf文件 ///
/// 报表文件数据(取 crystalReportViewer1.ReportSource = rp中rp的值)
/// 导出文件名称,例如:111.pdf
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);
}
}