Showing results for 
Search instead for 
Did you mean: 

ASP.NET CrystalReportViewer CSV Options

0 Kudos

Hello. I am using CrystalDecisions v13.0.2000.0 in an ASP.NET webforms site and I am using the CrystalReportViewer. The report has parameters and everything works perfectly when displaying the report in the web page. The user needs to be able to export to CSV and the built-in export button works but it includes the column names in every row and a secondary dialog is not presented to be able to specify additional options. I need to specify ReportSectionsOption = CsvExportSectionsOption.ExportIsolated. It seemed the solution was to write the report using ExportToHttpResponse on postback but all I get is the "Please wait while the document is being processed" message. Here is my code:

ReportInfo ri = Session[ReportName] as ReportInfo;
if (ri == null) return;
if (ReportName == "policies" && IsPostBack)
    ReportDocument rd = ri.ReportDocument;
    foreach (ParameterField pf in CrystalReportViewer1.ParameterFieldInfo)
        if (pf.ReportName == "") rd.SetParameterValue(pf.Name, pf.CurrentValues);
        else rd.SetParameterValue(pf.Name, pf.CurrentValues, pf.ReportName);
    CharacterSeparatedValuesFormatOptions csveo = new CharacterSeparatedValuesFormatOptions();
    csveo.Delimiter = "\"";
    csveo.SeparatorText = ",";
    csveo.GroupSectionsOption = CsvExportSectionsOption.DoNotExport;
    csveo.ReportSectionsOption = CsvExportSectionsOption.ExportIsolated;
    csveo.ExportMode = CsvExportMode.Standard;

    ExportOptions eo = new ExportOptions() { ExportFormatType = ExportFormatType.CharacterSeparatedValues, ExportFormatOptions = csveo };
    rd.ExportToHttpResponse(eo, Response, true, "policies.csv");
else CrystalReportViewer1.ReportSource = ri.ReportDocument;

What am I doing wrong? Also, oddly, the parameters that I enter in the report viewer are not set in the ParameterFieldInfo on postback. Where are these values?


Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

2000 is the framework version, look in Programs and features and look for the version there, or find crpe32.dll and look at that version.

Latest update is on the wiki:


Answers (0)