VB.NET Crystal Reports Export to Excel
To export data from Crystal Reports to the Excel format, we employ the Crystal Reports CrExportOptions. Furthermore, it is essential to configure the ExcelFormatOptions and set the ExportFormatType to Excel. In the subsequent example, you will find a demonstration of how to export a Crystal Reports document as an Excel file.
It is important to note that all the programming samples presented in these tutorials for Crystal Reports are built upon the crystaldb database. Prior to commencing this tutorial, I highly recommend acquainting yourself with the Database Structure. To access the database structure, kindly click on the following link: Click here to view the Database Structure.
In this tutorial, we will be utilizing our previous program, which thoroughly explains the step by step Crystal Report process of pulling data from a database into Crystal Reports. To ensure a comprehensive understanding, I suggest reviewing the step-by-step guide titled "Crystal Report in VB.NET" before proceeding with this section.
In the aforementioned step-by-step Crystal Report guide, we extract all the data from the Product table. However, in the current scenario, our objective is to export this retrieved data to an Excel file format.
Select the default form (Form1.vb) you created in VB.NET and drag two buttons (Button1, Button2 ) and CrystalReportViewer control to your form.
Select Form's source code view and import the following :
Put the following source code in the button click events
Full Source VB.NETcryRpt.Load("PUT CRYSTAL REPORT PATH HERE\CrystalReport1.rpt")
The Crystal Report is in your project location, there you can see CrystalReport1.rpt . So give the full path name of report here.
When you run this program you will get the Excel file (crystalExport.xls) in your computer's C:
- Sample Database and tables for Crystal Reports tutorials
- Step by Step help for creating a simple Crystal Reports in VB.NET
- VB.NET Crystal Reports from multiple tables
- VB.NET Crystal Reports String parameter
- VB.NET Crystal Reports Integer parameter
- VB.NET Crystal Reports Date parameter
- VB.NET Crystal Report Load Dynamically
- VB.NET Crystal Reports Formula Fields
- VB.NET Crystal Reports Summary Fields
- VB.NET Crystal Reports Export to PDF
- Email a Crystal Reports from VB.NET
- Crystal Reports Without Database
- Crystal Report from SQL Query String
- Dynamic Crystal Reports from SQL Query String
- Crystal Reports from XML File
- Create a Subreport in Crystal Reports
- Create a Subreport in Crystal Reports with Link
- How to deploy Crystal Reports on Clinet Machine
- How to create Crystal Reports installer using Merge Modules