cancel
Showing results for 
Search instead for 
Did you mean: 

Crystal report print directly without crystal viewer

Former Member
0 Kudos

HI !

In my addon i use Crystal Report. What would be the code i need to add if i want to print directly instead of having to go thru the crystal viewer.

The crystal viewer gives me lots of problems with painting the screen when i move the form and it allways opens in the task bar. I cant seem to control the window sizes of the viewer either so unless it's easyer to fix those problem i need help to go and print direct without the viewer....

Thanks for your time

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi again !

I'm using Crystal Report 10 with .net

Thanks

Former Member
0 Kudos

You can use the ActiveX object in the SDK to embed the crystal viewer directly into a business one form. I have built an add-on with Crystal XI Developer using this technique (It looks a lot better than my old Crystal V9 add-on that ran in V6.5 of B1 using a windows form). Sizing is easily handled by manually changing the Height/Width properties of the SDK object during the FORM_RESIZE event. Window refresh also works fine using the embeded approach.

If you want to print directly without showing the report in the viewer you can use the PrintOut method of the CRAXDRT.Report object.

John

Former Member
0 Kudos

Thanks John !

Sorry to ask ... but how do i use the PrintOut method of CRAXDRT.report object.....

Can you post a sample... Pretty new with this ...

Thanks

Former Member
0 Kudos

From memory a simple example would go something like this:-

Dim objReport As New CRAXDRT.Report

Set objReport = objAppl.OpenReport("c:\MyReport.rpt")

objReport.PrintOut True, 1

This will open up a previously saved RPT file and send it to the printer. The first parameter tells it if you want the printer options dialog to display, the second one is the number of copies. You can get more details of the parameters from the Crystal Help files. I am using Version XI but I think it will be the same in V10.

John.

Former Member
0 Kudos

Thanks this looks great !

One last question , !!!

I tried the code, but how do i define CRAXDRT.Report it gives me the error of type not beeing defined..

Thanks

Former Member
0 Kudos

You need to make sure you reference the appropriate library in your program. For Crystal XI it is:-

Library CRAXDRT
    C:Program FilesCommon FilesBusiness Objects3.0bincraxdrt.dll
    "Crystal Reports ActiveX Designer Run Time Library 11.0"

It will probably be called something similar in V10.

John.

Former Member
0 Kudos

Hi John !

Thanks again, I did find it for version 10. My addon loads allright i have this last error that i hope you can help me with.

Public Member 'Open Report' on type 'ApplicationClass' not found ???

Thanks again for your time. This is really helping and i'm sure it will help alot of others.

Alain

Former Member
0 Kudos

Hi again !

i added 'Dim objAppl As CRAXDRT.Application' it changes the error to 'Object reference no set to an instance of an object' ???

Am i getting closer ??

Former Member
0 Kudos

Hi John !

I finnaly made it work...

here's what i used

Dim objAppl As New CRAXDRT.Application
            Dim objReport As CRAXDRT.Report

            objReport = objAppl.OpenReport("C:Program FilesSAPSAP Business OneAddOnsDutiesresultat.rpt")
            objReport.PrintOut(True, 1)

Thanks alot for your time.

p.s.: I can i get the print window open on the screen instead of the task bar ??? it did that with the viewer too...

Thanks again

Answers (0)