Solved

Exporting Crystal Report to PDF - No Output

Posted on 2004-10-05
8
565 Views
Last Modified: 2008-01-16
Please help, this is not extremely urgent and I beleive that the solution is probably fairly simple. Unfortunately, I can not figure out what it is. I am trying to export a generated crystal report in CRviewer control to a PDF format. Every thing appears successful except for the final result when nothing is displayed... Here is my code: (thanks)

Imports System.Data.SqlClient
Imports CrystalDecisions.CrystalReports.Engine
Imports System.IO
-------------------------------------------------------
Private creport1 As New StandardDetailed
-------------------------------------------------------

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Put user code to initialize the page here
        Dim cnn As New SqlConnection
        cnn.ConnectionString = Main_C.csStandards
        cnn.Open()

        Dim da As New SqlDataAdapter("exec spWebApp_CS_CR_Standards_Detail '" & _
                        Session("Standards_CR_StandardDetailed_Formula").ToString & "'", cnn)

        Dim Dataset1 As New Standard
        da.Fill(Dataset1, "Header")

        creport1.SetDataSource(Dataset1.Tables("Header"))

        Me.CrystalReportViewer1.ReportSource = creport1
        Me.CrystalReportViewer1.Visible = True

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim oStream As New System.IO.MemoryStream
        creport1.ExportToStream(CrystalDecisions.[Shared].ExportFormatType.PortableDocFormat)
        Response.Clear()
        Response.Buffer = True
        Response.ContentType = "application/pdf"
        Response.BinaryWrite(oStream.ToArray())
        Response.End()
        oStream = Nothing

    End Sub
0
Comment
Question by:akzocols
  • 3
  • 3
  • 2
8 Comments
 
LVL 100

Expert Comment

by:mlmcc
ID: 12230599
Which version of Crystal?

mlmcc
0
 
LVL 42

Expert Comment

by:frodoman
ID: 12230655
I'm assuming CR9 or CR10, but is it the standalone version or the .Net version?

Have you tried other reports and found the same problem or is it just this one?  In particular note if the export works for a report (dataset) based on a table but not for one based on a stored procedure.

frodoman
0
 

Author Comment

by:akzocols
ID: 12230657
9.1.5000.0 for 2003.net

Also, just to make sure that what I stated earlier is clear... In the initial report create during Page_Load the report is populated with data. It is only during the export that I receive the blank browser window.
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 100

Expert Comment

by:mlmcc
ID: 12233254
I am not familiar with the .Net viewers, Is there an export button on it?  If so can you export to PDF from there?

mlmcc
0
 

Author Comment

by:akzocols
ID: 12236609
No, there are no export options built in to the GUI.
0
 
LVL 42

Accepted Solution

by:
frodoman earned 50 total points
ID: 12236652
You might want to try this approach instead of using the binary write: http://support.businessobjects.com/library/kbase/articles/c2010264.asp

0
 

Author Comment

by:akzocols
ID: 12237513
frodoman, this ultimately gets me closer to my goal. I did not want to create PDF's on server everytime one is requested, but never-the-less this should get me through the design phase. If you stumble across a solution for using the stream object, please keep me in mind.

Thanks!
0
 
LVL 42

Expert Comment

by:frodoman
ID: 12237540
I haven't seen an effective implementation but it's not something I spend much time with - you may want to search a little in one of the .Net forums and see if anyone there has stream based solution.

Cheers,

frodoman
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Change start of Week from Sunday to Friday 8 52
Crystal Reports 12 34
Sum of multiple formulas 6 18
Supress a section of a field 6 9
Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

778 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question