vb.net / Crystal Report
-
Dim PKCalls As DataTable = DirectCast(Session("GetPKCallS"), DataTable) PKCalls = New DataTable() Dim sc As New PK.BusinessLogicLayer.Consumer() Dim tDay As Integer Dim tCall As Integer Dim DD As String Dim CallActivity As String tDay = Integer.Parse(txtPast.Text) tCall = Integer.Parse(txtCall.Text) DD = Today.AddDays(-tDay) CallActivity = Today.AddDays(-tCall) PKCalls = sc.GetPKCallSheet(txtGender.Text, txtRace.Text, lblUpDOB.Text, lblLowDOB.Text, ddlSite.SelectedItem.Value, DD, CallActivity) Session("GetPKCallS") = PKCalls Dim cr As New ReportDocument() Dim cx As New ExportOptions() cr.Load("path to Crystal Report file") cr.SetDataSource(Session("GetPKCallS")) Dim N As String N = "CallSheets" & Session("userOffice") & Now & ".rpt.PDF" N = Replace(N, Chr(32), "") N = Replace(N, ":", "") N = Replace(N, "/", "") cr.SaveAs("filepath to destination" & N, ReportFileFormat.VSNetFileFormat) *********************************** *Given the above code, I am able to send this file to where I want it. When I try to open the file I get this: "Adobe Reader could not open 'Name.rpt.PDF' because it is either not a supported file type or because the file has been corrupted" ************************************* Please help, any examples are much appreciated. Thank you.
-
Dim PKCalls As DataTable = DirectCast(Session("GetPKCallS"), DataTable) PKCalls = New DataTable() Dim sc As New PK.BusinessLogicLayer.Consumer() Dim tDay As Integer Dim tCall As Integer Dim DD As String Dim CallActivity As String tDay = Integer.Parse(txtPast.Text) tCall = Integer.Parse(txtCall.Text) DD = Today.AddDays(-tDay) CallActivity = Today.AddDays(-tCall) PKCalls = sc.GetPKCallSheet(txtGender.Text, txtRace.Text, lblUpDOB.Text, lblLowDOB.Text, ddlSite.SelectedItem.Value, DD, CallActivity) Session("GetPKCallS") = PKCalls Dim cr As New ReportDocument() Dim cx As New ExportOptions() cr.Load("path to Crystal Report file") cr.SetDataSource(Session("GetPKCallS")) Dim N As String N = "CallSheets" & Session("userOffice") & Now & ".rpt.PDF" N = Replace(N, Chr(32), "") N = Replace(N, ":", "") N = Replace(N, "/", "") cr.SaveAs("filepath to destination" & N, ReportFileFormat.VSNetFileFormat) *********************************** *Given the above code, I am able to send this file to where I want it. When I try to open the file I get this: "Adobe Reader could not open 'Name.rpt.PDF' because it is either not a supported file type or because the file has been corrupted" ************************************* Please help, any examples are much appreciated. Thank you.
What CrystalReports is writing to your file is not a valid .PDF format. The version of CrystalReports that comes with Visual Studio, apparently, doesn't support .PDF. It looks like you'll have to upgrade to the full version of CR from BusinessObjects.com. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome