cancel
Showing results for 
Search instead for 
Did you mean: 

CSV ExportOptions for a Crystal Report Viewer

Former Member
0 Kudos

Hi all,

I've got a specific question about the CSV Export functionality (on a Web App).

I've put a button in my aspx page to export the content of the Crystal Report Viewer


ReportDocument _rptdListeBdc = new ReportDocument();

CharacterSeparatedValuesFormatOptions csvExpOpts = new CharacterSeparatedValuesFormatOptions();
ExportOptions exportOpts = new ExportOptions();
DiskFileDestinationOptions diskOpts = new DiskFileDestinationOptions();
exportOpts = _rptdListeBdc.ExportOptions;

csvExpOpts.GroupSectionsOption = CsvExportSectionsOption.DoNotExport;
csvExpOpts.ReportSectionsOption = CsvExportSectionsOption.DoNotExport;
csvExpOpts.ExportMode = CsvExportMode.Standard;
csvExpOpts.Delimiter = "\"";
csvExpOpts.SeparatorText = ";";
csvExpOpts.PreserveNumberFormatting = true;
            
exportOpts.ExportFormatType = ExportFormatType.CharacterSeparatedValues;
exportOpts.ExportDestinationType = ExportDestinationType.DiskFile;
exportOpts.ExportFormatOptions = csvExpOpts;

diskOpts.DiskFileName = "C:\\test.csv";
exportOpts.DestinationOptions = diskOpts;

_rptdListeBdc.Export();

Everything works fine, my question is : Is there any way to do the same things with the Export button of ther crystal report viewer ?

I've only found property AllowedExportFormats but nothing about the formats themselves.

Thanks in adavance.

Fred.

Accepted Solutions (1)

Accepted Solutions (1)

former_member183750
Active Contributor
0 Kudos

Hello Fred

You do not mention what version of CR or .NET you are using, but I assume it is not VS2010 \ CRVS2010. In CRVS2010, you can select what ever formats you want to show as available for export from the viewer. This is the first version of CR to allow for that. For mroe info, see the wiki [Available Export Formats, Crystal Reports 9.1 to Crystal Reports for Visual Studio 2010|http://wiki.sdn.sap.com/wiki/x/FINiAw].

- Ludek

Former Member
0 Kudos

Hello Ludek,

Exactly, I use VS2010. There is no problem for selecting the format of export for the Crystal Report Viewer, it works fine.

I make CSV format available but I can't specify more options about it (as an example, modify the delimiter, don't export the group header and footer) .

Thanks.

Fred.

former_member183750
Active Contributor
0 Kudos

To set those options, you will have to create your own export to CSV button and code them there - using the code you already have. I think the ability of setting the export options from the viewer would be a great enhancement. If you want, you can ask for it in the [SAP Idea Place|https://ideas.sap.com/community/products_and_solutions/crystalreports] and perhaps one day we'll see it implemented.

- Ludek

Edited by: Ludek Uher on Oct 18, 2011 8:11 AM

Former Member
0 Kudos

Thanks Ludek for all your answers.

former_member183750
Active Contributor
0 Kudos

Hello Fred

Just went to the Idea Place to enter this as an idea and saw that you have already done so. Many thanks for doing that. I voted it up one...

Have a great weekend,

- Ludek

Answers (0)