Symptom
Using CR for VS SP 15 or SP 17 seems to have changed the export to CSV output, it no longer uses the Delimiter or separator saved in the RPT file.
Environment
- Crystal Reports for Visual Studio SP 15
- Crystal Reports for Visual Studio SP 17
Reproducing the Issue
Resolution
This issue has been esclated to R&D for a fix and should be in SP 18 due out end of September, 2016
Work around:
Create an Export Button and use the following code, mode as required:
CrystalDecisions.CrystalReports.Engine.ReportDocument doc = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
doc.Load(@"D:\Reports\integratedSecurityMSSQLWithData.rpt");
CrystalDecisions.Shared.CharacterSeparatedValuesFormatOptions csvExpOpts = new CrystalDecisions.Shared.CharacterSeparatedValuesFormatOptions();
CrystalDecisions.Shared.ExportOptions exportOpts = new CrystalDecisions.Shared.ExportOptions();
CrystalDecisions.Shared.DiskFileDestinationOptions diskOpts = CrystalDecisions.Shared.ExportOptions.CreateDiskFileDestinationOptions();
diskOpts.DiskFileName = @"d:\reports\CSVExportNoDelimitorseparator.csv";
csvExpOpts = new CharacterSeparatedValuesFormatOptions();
csvExpOpts.ExportMode = CsvExportMode.Standard;
//csvExpOpts.GroupSectionsOption = CsvExportSectionsOption.ExportIsolated;
//csvExpOpts.ReportSectionsOption = CsvExportSectionsOption.DoNotExport;
csvExpOpts.SeparatorText = "#";
csvExpOpts.Delimiter = ",";
exportOpts.DestinationOptions = diskOpts;
exportOpts.ExportDestinationType = ExportDestinationType.DiskFile;
exportOpts.ExportFormatType = ExportFormatType.CharacterSeparatedValues;
exportOpts.ExportFormatOptions = csvExpOpts;
try
{
doc.Export(exportOpts);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
return;
}
Keywords
CR for VS, .NET, CSV, WPF, export to CSV , KBA , BI-DEV-NET , BI Software Development Kits (SDKs) - .NET or Other , Problem