Solved

Exporting Crystal Report to PDF - No Output

Posted on 2004-10-05
8
568 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
8 Comments
 
LVL 101

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
On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

 
LVL 101

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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

724 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