Skip to Content

Error while Export excel from .net

Nov 07, 2017 at 09:14 PM


avatar image

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:



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;



catch (Exception ex)



The code is working fine for PDF or even ExcelRecord or ExcelWorkbook but it is not maintaining formatting.

Thanks in advance.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Don Williams
Nov 07, 2017 at 09:16 PM

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.


10 |10000 characters needed characters left characters exceeded