Reputation: 2104
I need to export excel file with crystal report.
Is there any way to export data only without formatting by using code?
Upvotes: 1
Views: 5706
Reputation: 12731
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..
Upvotes: 1