1
votes

I need to export excel file with crystal report.

Is there any way to export data only without formatting by using code?

1
Please specify more details. In crystal report there are inbuilt functionality to export report in excel/pdf.Upendra Chaudhari
noa have you tried my solution?Emanuele Greco
I added some options, i have used an instance of ExcelFormatOptions class instead of using ExportFormatType.ExcelRecord directlyanouar.bagari

1 Answers

1
votes

You can export data shown in the report without formatting, in different ways:

1- Replace the CrystalReportViewer Control with the ReportExporter Control. It will export the report in the format you choose.

2- Call ExportToHttpResponse method

CrystalReportSource1.ReportDocument.ExportToHttpResponse(ExportFormatType.ExcelRecord, this.Response  , false, "report.xls");`

3- Call ExportToDisk method

reportDocument.ExportToDisk(ExportFormatType.ExcelRecord, "report.xls");

4- Export dataset to excel (Look at Ahmed answer)

You can choose the way that best fits your needs, but you must try if it works with the runtime you use either in development or in release server.

ExportFormatType.ExcelRecord means that is generated an xls file, without formatting. If you set ExportFormatType.Excel fields that are marked as "Can Grow" are merged with an otherwise blank row below them..