Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Crystal Reports ActiveX and .Net Inter Operability

Status
Not open for further replies.

mgayb

Programmer
Oct 2, 2002
10
US
I have noticed that the Crystal Report Viewr witin .NEt does not show the printer button or the export file button.
However the Crystal Reports ActiveX Viewer Control does show the buttons. I want to be able to include the ActiveX Control in a .NET ASP application. I am able to make a reference to the ActiveX Control in my WebForm but when I load the report (which loads successfully) the viwer does not display the report. I did try this in a normal .NET Windows application and it works just fine...but in the Web application it does not work.

Here is the code within my Test.aspx page:
==========================================

(I have references set to the COM objects CRViewerLib and CRAXDRT....on the COM Tab they are:
Crystal Report Viewer Version 8.0
Crystal Report 8 ActiveX Design Time Library )


Public Class Test
Inherits System.Web.UI.Page

Protected CRXViewer As New CRVIEWERLib.CRViewer()
Protected CRReport As New CRAXDRT.Report()
Protected CRApp As New CRAXDRT.Application()

Private Sub Page_Load(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MyBase.Load

CRReport = CRApp.OpenReport("c:\\Report1.rpt")
CRXViewer.ReportSource = CRReport
CRXViewer.ViewReport()

End Sub

End Class

I added the ActiveX Control to my toolbox in the WebForm and dragged it into the webform in design mode...gave the object an ID=CRXViewer. The code in my Test.aspx.vb does not seem to be able to reference the CRXViewer object in the designed form. It seems the CRXViewer object created in the vb code is not the same as the object on the form.

The application runs fine without any errors but does not display the report in the client browser. (I designed the report in Crystal 8.0 and not the .Net Crystal designer.
Again this works just fine as a .NET Windows application.

Basically I want to be able to use the ActiveX Crystal Viewer Control(which includes printer button and export buttons)within a Web Form in .NET
 
We tried this and got it to work but It would not scale and caused plenty of problems which did not appear until we moved the project to production. Microsoft told us it a known problem with com interop. We had to dump this approach and export to pdf to allow our users to print.
 
Would you mind if I ask how you got it to work...I would not mind having a go at it as well. I have a few drill down reports which will mean that after drill down a user will first have to do an export to pdf before printing. Also how exactly does the export code look like. Did you manage to add the Export button to the toolbar of the built-in .NET Crystal Viewer. How did you implement the export button...seperate button outside the viewer ?

When you refer to export was this with the AcctiveX control or the .NET Crystal Viewer. I presume it was with the .NET Web Viewer.
 
If you look at the posting by stich on "How to integrate..." I posted a copy of the code we are using now. I don's use the report viewer at all but export to a temp file and then display the report in a pdf viewer on the client. The client clicks a menu button to display the report and the next thing they see is the report in a pdf viewer.

The old code will take me some time to locate. Send me an e-mail and I'll try to dig it up.
 
I dont see your email address on the forum but here is mine if you are able to dig up that code. Thanks for all the help

E:Mail: mark.gaybba@turner.com

 
Would you mind tell me that where to find the COM objects CRViewerLib and CRAXDRT.

I also want to use the activeX to print the report on the client side. Could you give me some hint and sample?
Moreover, How do you solve your problem?

 
To answer your first 2 questions:

You need to have independently installed Crystal Reports (not the .NET version) on your computer.
You will find crviewer.dll in :
c:\Program Files\Seagate Software\Viewers\ActiveXViewer

You will find CRAXDT in:
c:\Program Files\Seagate Software\Report Designer

My solution:

I ended up not using the ACtiveX Control...had to many problems trying to use it. Instead I ended with a solution similar to what "cjlarue" did above. I have a print button on my web form which generates the report and outputs it directly as a temp pdf file which then gets displayed in the client browser as a pdf file. Works quite well. There is a pdf document on the Crystal Reports website that explains all the options available for printing from a web app.

Send me your email address and I will send you the article.
My email is: mark.gaybba@turner.com

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top