on 2018 Dec 18 6:20 PM
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?
Thanks.
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:
https://wiki.scn.sap.com/wiki/display/BOBJ/Crystal+Reports%2C+Developer+for+Visual+Studio+Downloads
Don
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
80 | |
11 | |
10 | |
10 | |
10 | |
8 | |
8 | |
7 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.