Are you using Visual Studio.net?
If so, just use the built-in crystal reports for .net.
Crystal has a bunch of samples that show how to export the reports to different file types.
I first added a dataset to my project that was based on the resultset of a SQL Server stored procedure. Then I added a new crystal report to my VS.net project and based it on the dataset. Here's the code I use to fill the dataset with the results of the stored procedure, bind the report to the dataset, display the report in a crystal report viewer, and export the report to both xls and pdf files:
Private Sub RunVarianceReport()
Dim cn As New SqlClient.SqlConnection()
Dim cmd As New SqlClient.SqlCommand()
Dim da As New SqlClient.SqlDataAdapter()
Dim oRpt As New VarianceReport() 'Name of my report
Dim ds As New VarianceDataset() 'Name of my dataset
Dim strExportFilePath As String
Dim DiskOpts As New CrystalDecisions.Shared.DiskFileDestinationOptions()
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.