Print Page | Close Window

Automate Report Export

Printed From: Crystal Reports Book
Category: Crystal Reports for Visual Studio 2005 and Newer
Forum Name: Writing Code
Forum Discription: .NET programming API, report integration
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=2001
Printed Date: 05 May 2024 at 10:48am


Topic: Automate Report Export
Posted By: harlylux
Subject: Automate Report Export
Date Posted: 08 Jan 2008 at 8:39am

I am building a winform (vs 2005 w/vb) to automate report exports to both excel and pdf. I am running into some problems. What is the best type of report object to use for this purpose. I am currently using:

Private Report As New Report_n
Sub ...
        Report = New Report_n()
        Report.Load()
        CrystalReportViewer1.ReportSource = Report
 
end sub
 
My Problem is that when I try to automate the export, it won't work because the crystalreporviewer does not know when report is loaded so it tries exporting the report before it's loaded which causes an error. Any adivce? Thanks



Replies:
Posted By: BrianBischof
Date Posted: 08 Jan 2008 at 8:52am
I wouldn't use the viewer b/c you don't need to view anything. You just want to save the report to disk. I would do so using the ReportDocument object. However, I haven't heard of exporting the report before it's loaded. It should stay on the Load() method until finished and then move to the next line in your code. Try using the ReportDocument object and single stepping it if necessary to debug.

-------------
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>



Print Page | Close Window