SAP Knowledge Base Article - Public

1767650 - Report CSV export options are ignored in a Visual Studio .NET application

Symptom

  •  Using Crystal Reports for Visual Studio 2010
  • Exporting to CSV format in code:

ReportDocument.GroupSectionsOption = CsvExportSectionsOption.ExportIsolated

  • The export behavior is as if the GroupSectionOption was set to just Export

Environment

  • Crystal Reports for Visual Studio 2010
  • Visual Studio 2010

Cause

  • Incorrect options we rest in the report designer

Resolution

  •  In the Crystal Reports designer, click file, then Export Options, Report Export Options
  • Select CSV and check on the Group.... option
  • In code use the InProc RAS SDK:
CrystalDecisions.ReportAppServer.ReportDefModel.ExportOptions RASexportOpts = new CrystalDecisions.ReportAppServer.ReportDefModel.ExportOptions();
CrystalDecisions.ReportAppServer.ReportDefModel.CharacterSeparatedValuesExportFormatOptions RASCSVExptOpts = new CharacterSeparatedValuesExportFormatOptions();
rpt.Load(@"D:\Atest\Ido\Union 28 Payroll Upload1.rpt");
rptClientDoc = rpt.ReportClientDocument;
 
RASCSVExptOpts.ExportMode = CrCSVExportModeEnum.crCSVExportModeStandard;
RASCSVExptOpts.GroupSectionsOption = CrCSVExportSectionsOptionEnum.crCSVExportSectionsOptionExportIsolated;
RASCSVExptOpts.ReportSectionsOption = CrCSVExportSectionsOptionEnum.crCSVExportSectionsOptionDoNotExport;
RASCSVExptOpts.Separator = ",";
RASCSVExptOpts.Delimiter = "|";
 
RASexportOpts.ExportFormatType = CrReportExportFormatEnum.crReportExportFormatCharacterSeparatedValues;
RASexportOpts.FormatOptions = RASCSVExptOpts;
rptClientDoc.PrintOutputController.ExportEx(RASexportOpts).Save(@"D:\Atest\Ido\Union 28 Payroll UploadExportIsolated.csv", true);

Keywords


CR2010 2010 CR4VS2010 CR4VS VS2010 NET2010 Crystal Reports for .NET Framework 4.0 crforvs 13  Crystal Reports for Visual Studio 2010 , KBA , BI-DEV-NET-SDK , .NET SDK / COM SDK , How To

Product

Crystal Reports 2008 V1 ; SAP Crystal Reports, developer version for Microsoft Visual Studio