Skip to Content
avatar image
Former Member

PDF Export not working right in SP21

I have created a report that when exported the text is not right and some of the fields are filling with random data. Like 6 digit Client account numbers are being replaced with the names of colors. Examples shown attached.

This is correct and shows in the preview of the Report Viewer

This is what it looks like when exported to .pdf

My code that runs this is as follows;

private void printToPDFToolStripMenuItem_Click(object sender, EventArgs e)
 ExportOptions crExportOptions;
 DiskFileDestinationOptions crDestination = new DiskFileDestinationOptions();
 PdfRtfWordFormatOptions crFormatOptions = new PdfRtfWordFormatOptions();
 Reports.WCReport report = new Reports.WCReport();
 FolderBrowserDialog browser = new FolderBrowserDialog();
 foreach (string row in clientIDs)
 List<ReportData> newReportData = reportData.FindAll(
 delegate (ReportData rd)
 { return rd.CompanyCode == row; }
 crystalReportViewer1.ReportSource = report;
 crDestination.DiskFileName = $"{browser.SelectedPath}\\{row}.pdf";
 crExportOptions = report.ExportOptions;
 crExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
 crExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;
 crExportOptions.ExportDestinationOptions = crDestination;
 crExportOptions.ExportFormatOptions = crFormatOptions;
 MessageBox.Show($"Company: {row}, could not be exported due to some error in export.");
original01.png (2.0 kB)
problem01.png (8.4 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Oct 11, 2017 at 08:53 PM

    Hi Adam,

    Was it working before?

    Did you read the info on the download page about updating the project?

    If you preview and then export from the Viewers Export Button does it work?


    Add comment
    10|10000 characters needed characters exceeded