cancel
Showing results for 
Search instead for 
Did you mean: 

Error while Export excel from .net

Former Member
0 Kudos

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.

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

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

Answers (0)