Skip to Content

PDF Export not working right in SP21

Oct 06, 2017 at 05:49 PM


avatar image
Former Member

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)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Don Williams
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?


10 |10000 characters needed characters left characters exceeded