Solved

Exporting Crystal Report to PDF - No Output

Posted on 2004-10-05
8
564 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
 
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

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…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

705 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now