on 11-07-2017 9:14 PM
I am using CrystalDecisions.CrystalReports.Engine.dll version 13.0.2000.0 and Visual Studio 2013. I am trying to export crystal report having sub reports to excel. It is crashing the IIS worker process when I call reportDocument1.Export();
Please refer below code:
try
{
ExportOptions exportOptions;
DiskFileDestinationOptions diskFileDestinationOptions = newDiskFileDestinationOptions();
ExcelFormatOptions formatTypeOptions = newExcelFormatOptions();
diskFileDestinationOptions.DiskFileName = @"c:\ritesh\report.xls";
exportOptions = reportDocument1.ExportOptions;
reportDocument1.ExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
reportDocument1.ExportOptions.ExportFormatType = ExportFormatType.Excel;
exportOptions.ExportDestinationOptions = diskFileDestinationOptions;
exportOptions.ExportFormatOptions = formatTypeOptions;
reportDocument1.Export();
}
catch (Exception ex)
{
}
The code is working fine for PDF or even ExcelRecord or ExcelWorkbook but it is not maintaining formatting.
Thanks in advance.
Open the Report in CR Designer and test it there to see if it works?
If it does then click the Menu option to export and select the Saved options. You can then get the saved options in code from the report and use those settings.
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 |
---|---|
96 | |
11 | |
11 | |
10 | |
9 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.