Solved

Exporting Crystal Report to PDF - No Output

Posted on 2004-10-05
8
567 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 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
On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

 
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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. …
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…

730 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