Crystal Report supports export of Reports in many formats. In these tutorials let us explore how to export Crystal report using the various options available in Crystal Reports.
- Exporting Crystal Reports To Pdf
- How To Convert Crystal Report To Pdf In Asp.net Using Vb.net
- Crystal Reports Export To Pdf
- Convert Crystal Report To Pdf In Vb6
You can look at the various export formats that are supported by the Crystal Report from the tutorials Crystal Report Export formats
If you are new to Crystal Report you can look at our following tutorials to get started
Table of Content
- How to Export Crystal Report
- Crystal Report Viewer Control
- Export Crystal Report Using Report Document (SDK)
How to Export Crystal Report
Jun 23, 2006 Currently I have an old developed system which use CR 9 with VB.Net 6. System deployed in Windows 2003 server. How can I use this method to convert to PDF with our old code? (Currently windows 10 not support crystal reports viewer.) We use report.asp file which gets data by session.
Crystal Report can be exported in two ways
- Using Crystal Viewer Control.
- Using the method provided in Report Document Object (SDK).
Crystal Report Viewer Control
Crystal Report Viewer control is a .NET control. You can add it to your windows form or to web form so that you can display the report to the user. You can add this control to the form by dragging it from the toolbox.
Crystal Report viewer control displays the report to the user at runtime. It has the option to print, search, browse through the pages of the report. It has also had the option to export the report. This Option found at the top left corner of the Report
To Export to The Report do the following
Export Crystal Report Using Web Application
- Run your Crystal Report Project.
- Select the Export Report button at the top Left Corner.
- From the File Format Drop drown select appropriate format.
- From Page Range Option Select All Pages
If you want print selected pages choose Select Pages and enter the from and to page No. Note that some of the file formats has this feature disabled - Click on Export.
- File is downloaded.
Export Crystal Report Using Windows Application
Export Crystal Report in Windows Application
- Run your Crystal Report Project
- Select the Export Report button at the top Left Corner
- From the Save as Drop drown select appropriate format
- Note that Page Range option is not provided in the windows version of Crystal Report Viewer Control
- In File Name Option enter the name of the file
- Click on Save
Export Crystal Report Using Report Document (SDK)
Another way to Export crystal report is using the Methods provided in Report Document object. This option gives us the most flexibility when comes to exporting the report.
All the methods are available in the Namespace CrystalDecisions.CrystalReports.Enginewhich is contained in the assembly (dll) CrystalDecisions.CrystalReports.Engine.dll
Here is the list of Methods available in the SDK.
ExportToDisk
Use this option to export the report to disk. Method has following Option
Introduction
What Is Crystal Reports?
'In simplest terms, Crystal Reports is a report design tool that allows you to create reports capable ofretrieving and formatting a result set from a database or other data source. In addition to simply readingdata from a data source, Crystal Reports has its own formula language for creating calculations andincludes a number of features that can be used to turn raw data into presentation-quality reports, withgraphs, charts, running totals, and so on.'(David McAmis, Professional Crystal Reports for Visual Studio .NET, 2nd edition)
We give this option to users to download there on copy of result what they want from search result.
Sqlserver Part
Create a Simple Table Name as PersonInfo
:
Inserting Records
Insert Records into Table from backend
Selecting Records for displaying on report Using StoredProcedure
Create a new ASP.NET Web Application Project.
Add New Web form -> Name it as ExportRecords.aspx.
Adding Crystal Report
When this Screen appears in front of you, just select (Standard) and Press Ok button.
The Standard Report Creation Wizard will pop
Select Create New Connection.
- Inside That OLE DB
- A new Wizard will pop up OLE DB (ADO)
- It will ask for Provider
- Select (Microsoft OLE DB Provider for SQL Server)
- Click Next Button
Connection Information Wizard will appear.
Just enter your SQL Server details here.
Then click on Next button
After click on Finish this wizard will appear.
- First select your Database where you have created table.
- Inside that you will find 3 options
- dbo
- INFORMATION_SCHEMA
- Sys
- Select dbo (Here you will see 2 options)
- Tables
- Stored procedures
- Select Store procedures from it.
(Because we will bind Store procedures to report to display information)
Exporting Crystal Reports To Pdf
The Store procedures Usp_getPersonRecords
will appear in the list of data sources, add the Store procedures to selected table list by clicking on the right arrow.
Click Next button
This wizard will appear.
Select all columns and then clicking on the right arrow to move in Fields to Display
Click on Next Button
We will not perform Grouping Just click Next Button
This wizard will appear.
We will not perform Record Filter Just click Next Button
This wizard will appear.
Select Standard from it and click Finish.
After Finishing the crystal report will appear to you.
Just Save it.
Let’s Move from sql to Web forms now. (ExportRecords.aspx)
On Page Add Crystal Report viewer and three images buttons
(I have add images to buttons)
Like this View you will see
On load for Binding crystal Report i have created Method GenerateReport()
.
You need to add Connection string above Page load.
And add Connection string In Web.config.
For doing connection with database you need to add connection string to databaseHere is example of it.
Just replace here with your database value.
Data source
Database
User id
Password
Here I have bind crystal report on page load event.
This is method which I am using for binding crystal report on page load.
How It Works
On button click we are going to Export crystal report in pdf, Excel, html, format.
We are bringing all data from sql server into dataset and binding dataset to crystal report data source.
Creating object of report document
After creating object we are going to load crystal report by giving its path.
Here we are assigning format to export.
First Button (Img1 for exporting records in PDF format)
On button click we are going to Export crystal report in PDF format.
First Second (Img2 for exporting records in Excel format)
On button click we are going to Export crystal report in Excel format.
First Third (Img3 for exporting records in Word format)
On button click we are going to Export crystal report in Word format
Now save and run project.
All records will appear on Crystal report.
With five buttons to Export.
On clicking of PDF button.
How To Convert Crystal Report To Pdf In Asp.net Using Vb.net
On clicking Excel button.
On clicking of Word button.
On clicking of HTML button.
On clicking of RTF button
Crystal Reports Export To Pdf
Making Easy to Understand
Comments are closed.