SAP Knowledge Base Article - Public

1337119 - CR .NET SDK export to CSV format is missing data

Symptom

  • Missing data in CSV file 
  • Crystal Reports .NET Windows or web application
  • Export to CSV (character separated value) format using Export() method 

Environment

  • Crystal Reports 2008
  • .NET Framework 2005
  • Crystal Reports .NET SDK

Cause

  • The CharacterSeparatedValuesFormatOptions class defaults to Legacy ExportMode

Resolution

  1. Set the CharacterSeparatedValuesFormatOptions.ExportMode = CsvExportMode.Standard
ReportDocument boReportDocument = new ReportDocument();
boReportDocument.Load(path + "\\MyReport.rpt");
 
ExportOptions boExportOptions = boReportDocument.ExportOptions;
DiskFileDestinationOptions boDiskFileDestinationOptions = new DiskFileDestinationOptions();
CharacterSeparatedValuesFormatOptions boCSVFormatOptions = ExportOptions.CreateCharacterSeparatedValuesFormatOptions();
 
boDiskFileDestinationOptions.DiskFileName = path + "\\export\\~export.csv";
boCSVFormatOptions.SeparatorText = ",";
boCSVFormatOptions.Delimiter = "\"";
boCSVFormatOptions.ReportSectionsOption = CsvExportSectionsOption.Export;
boCSVFormatOptions.GroupSectionsOption = CsvExportSectionsOption.Export;
boCSVFormatOptions.ExportMode = CsvExportMode.Standard;
boExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
boExportOptions.ExportDestinationOptions = boDiskFileDestinationOptions;
boExportOptions.ExportFormatType = ExportFormatType.CharacterSeparatedValues;
boExportOptions.ExportFormatOptions = boCSVFormatOptions;
 
boReportDocument.Export(boExportOptions);
boReportDocument.Close();
boReportDocument.Dispose();

Keywords

KBA , BI-DEV-NET , BI Software Development Kits (SDKs) - .NET or Other , Problem

Product

Crystal Reports 2008 V1