?
Solved

Exporting Crystal Report to PDF - No Output

Posted on 2004-10-05
8
Medium Priority
?
569 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

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.

 
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 150 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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
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…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses
Course of the Month11 days, 8 hours left to enroll

752 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