Getting started with Crystal Reports...little help in the far court.

Amaury Forgeot d'Arc afaNOSPAM at
Tue Jan 9 00:29:34 CET 2007

Good evening,

Mudcat a écrit :
> I am not that familiar with Crystal Reports, but having read some other
> posts I know that the way to integrate the API with Python is through
> the COM interface provide by win32all.
> However, I have been unable to find any other information on how to get
> started. I've used the COM interface before in integrating Excel and a
> couple of other things. So I am familiar with how that works. But there
> are at least 40 options dealing with Crystal and Business Objects. I
> have no idea which makepy file to create or which one provides the
> functionality I need.
> I'm not looking to do much. All I'm really trying to do is provide one
> application where a list of crystal reports can be selected and ran in
> series. Right now we have a lot of reports that all have to be run
> manually (takes a while). So I think all I need api access to is server
> selection, parameter selection, and output formats.
> Any pointers in the right direction would be helpful.

In my previous job we had to to almost the same thing.
If I remember correctly, for batch printing or file export it was enough 
to start with the "CrystalRuntime.Application" class.

It was something along these lines (sorry I don't have any way to test 
it now.):
     app = win32com.client.dynamic.Dispatch("CrystalRuntime.Application")
     report = app.OpenReport("c:/path/to/file.rpt")
     for table in report.Database.Tables:
         table.ConnectionInfo.Password = "passwd"
The rest is modeled after Visual Basic. There are tons of examples on 
the net.

If you want to show the report on the screen then it is another story.
I only remember the following:
- the application must be a mfc application
- I had to "makepy" a class. I think it was "CrystalReportsViewer".
- create a class derived from both pywin.mfc.activex.Control and 
CrViewer (look at the script generated by makepy).
- create a pywin.mfc.Frame, and put there an instance of the previous class.

Voilà, it's not much.
In the hope that you can do something with it.
But don't give up. At the end, it works...


More information about the Python-list mailing list