Can anybody give me some knowledge (links) as to how I would export my ASP.NET Crystal Report to PDF.
The way I see it, is I set up a button, that when clicked, exports the report to PDF.
Any help would be appreciated.
One more question. How do I change the connection string?
Why not use the export button in the crystalviewer control.
I'm using VS 2003 ASP .NET, NOT VB .NET. In VB .NET the Crystal Report viewer gives you an option to export to PDF. In ASP .NET the View does not give you that option.
If I am wrong on this, do please let me know.
In the mean time I found an article that helped me greatly.
That article was very helpful. Now I can export to Excel or PDF .
Still wondering how to change the connection string, otherwise when I move this application to the server it will not function.
hello my friend
i had the same problem with the PDF conversion i solved it with this code i found:
Dim myReport As New ReportDocument
Dim myExportOptions As New CrystalDecisions.Shared.ExportOptions()
Dim myDiskFileDestinationOptions As New CrystalDecisions.Shared.DiskFileDestinationOptions()
Dim myFormatTypeOptions As New CrystalDecisions.Shared.PdfRtfWordFormatOptions()
Dim s As String = TextBox1.Text
myDiskFileDestinationOptions.DiskFileName = "C:\Inetpub\wwwroot\TDWS\" + s + ".pdf"
myExportOptions = myReport.ExportOptions
.ExportDestinationType = CrystalDecisions.Shared.ExportDestinationType.DiskFile
.ExportFormatType = CrystalDecisions.Shared.ExportFormatType.PortableDocFormat
.DestinationOptions = myDiskFileDestinationOptions
.FormatOptions = myFormatTypeOptions
MsgBox("Your report has been exported in PDF format and saved to C:\CrystalReports\Chapter08\test.pdf", MsgBoxStyle.Information, "Shut Up")
but the problem is u cant contol where its gonna b saved from the page , u have to type the path manually in the code which is so annoying
so using the crystal Report tool bar will b better , i'll check the link u mentioned also
about the connection string:
i dont know if u r using MS Access or SQL Server ,, but i've tested the below code and its working perfectly:
in ur web config add this:
<add key="MyConn" value= "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Inetpub\wwwroot\data\northwind.mdb;" />
in ur code u can call ur connection by using this line:
Dim myConnection As OledbConnection = New OledbConnection(ConfigurationSettings.AppSettings("MyConn"))
for SQL connection , add the connection by wizard "Add DB Connection" -which will add it automaticlly to ur web.config- then add these lines to ur code:
Dim s As String= System.Configuration.ConfigurationManager.ConnectionStrings"TESTDBConnectionString1").ConnectionString
Dim DBConn As Data.SqlClient.SqlConnection
DBConn = New SqlConnection
there might be a better way to do this ofcourse, but this is how i did it , and its working.
of course u have to Imports System.Data.SqlClient or Oledb
if u can do me one favour and direct me to a tutorial for crystal reports 11 ... need to know how to Group Data n Build Drill Down Reports and Use Formulas