Crystal Reports is a business intelligence application used to design and generate reports from a wide variety of data sources. It is distributed with many software applications, and integrated development environments. In this article, I want to describe how to export Crystal reports to PDF, Word, Excel. For this Example i have used Northwind Database and Employees table. After you have finished Creating Crystal Reports, place one button on the aspx page to export report to pdf or word format. We’ll write code in Page_Load Event to load report when page loads and in Click Event of button to create pdf, word or excel report.
HTML Source Of Page
C#
VB.NET
Build and run the code. To Export crystal Reports to Word Excel or other formats we need to change below mentioned line of code to desired format.
For MS Word
pdfReport.ExportToHttpResponse(ExportFormatType.WordForWindows, Response, true, "Employees");
Where Employees is the name of file you want to be created.
For MS Excel
pdfReport.ExportToHttpResponse(ExportFormatType.Excel, Response, true, "Employees");