Can we display crystal report using asp.net core 6 on web page ? if yes then which method, or tool we can use to implement this ?
also need export functionality in Excel and PDF. currently have searched many article but still not find any relevant or proper solutions.
how can i implement this functionality using asp.net core 6 ?


Abhishek YadavRank #217 · 11.3K reputationPosted Aug 7, 2024, 6:43 AM EDT
Request for Purchase of Office Vacuum Cleaner
Yes, you can use Crystal Reports in ASP.NET Core 6, but it requires a bit of work since Crystal Reports is not natively supported in .NET Core. Here’s a general approach to achieve this:
1. Using Crystal Reports with ASP.NET Core 6
To use Crystal Reports in an ASP.NET Core 6 application, follow these steps:
Install Crystal Reports Runtime:
Create a .NET Framework Class Library:
Add a Web API in ASP.NET Core:
Expose Reports from .NET Framework Library:
Call API from ASP.NET Core Application:
2. Export Functionality (Excel and PDF)
To add export functionality:
Export to PDF:
ReportDocument.Exportmethod to export reports to PDF.var reportDocument = new ReportDocument(); reportDocument.Load("path_to_report.rpt"); var pdfExportOptions = new ExportOptions(); var pdfOptions = new PdfRtfWordFormatOptions(); pdfExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat; pdfExportOptions.FormatOptions = pdfOptions; reportDocument.Export(pdfExportOptions);Export to Excel:
ReportDocument.Exportmethod withExcelFormatOptionsto export reports to Excel.var excelExportOptions = new ExportOptions(); var excelOptions = new ExcelFormatOptions(); excelExportOptions.ExportFormatType = ExportFormatType.Excel; excelExportOptions.FormatOptions = excelOptions; reportDocument.Export(excelExportOptions);While Crystal Reports doesn’t directly support .NET Core, you can work around this by using a .NET Framework Class Library to handle report generation and export functionality. Then, expose this functionality through a Web API that your ASP.NET Core application can consume.
If you need more details or specific code examples, let me know!