using Crystal Report Viewer in PHP

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
livewire
Forum Newbie
Posts: 2
Joined: Wed Nov 15, 2006 1:42 pm

using Crystal Report Viewer in PHP

Post by livewire »

Hi All,

Does anyone out there know how to implement the "Crystal Report Viewer" (CR 11) using PHP?

After doing some research I know how to generate a report and display it as a PDF file, but some of the reports we've been asked for require the CR Viewer (to fetch parameters). Further research lead me to believe that the only way to implement the Viewer is via ActiveX (GAK!) or Java Beans. I'm new to both CR and Java and would like to find a way to avoid reading the 500 pages of (decidely biased) documentation that CR has, so if anyone out there has a useful code snipet or link to a tutorial or something similar, please help asap!

Thanks!
Mitch
User avatar
dibyendrah
Forum Contributor
Posts: 491
Joined: Wed Oct 19, 2005 5:14 am
Location: Nepal
Contact:

Post by dibyendrah »

Try using COM

Code: Select all

$cr=new com("Crystal.CRPE.Application") or die("cannot load cr com");
$rn="reports/report1.rpt";
$rap=$cr->OpenReport($rn);
Hope this will help you.

regards,
Dibyendra
livewire
Forum Newbie
Posts: 2
Joined: Wed Nov 15, 2006 1:42 pm

Post by livewire »

Using COM objects will access the report, but not open it in the Crystal Report Viewer. (The "OpenReport" method only accesses the report, i.e. creates an object reference to the report, it doesn't display the report). I couldn't find anything in the reference documentation for the report object that indicated any way to display or view the report other than exporting it to another format first. This is fine for simple reports, but it doesn't work for reports that require additional paramteres. We want to use the Viewer to avoid having to code the pages involved in prompting the user for parameter values. But, as I mentioned, the only way to do this, according to the Crystal Reports documentation, is with Java Beans or ActiveX. I'm hoping there's someone out there who's already done this so I don't have to reinvent the wheel. Anyone?!?

Thanks!
Mitch
User avatar
dibyendrah
Forum Contributor
Posts: 491
Joined: Wed Oct 19, 2005 5:14 am
Location: Nepal
Contact:

Post by dibyendrah »

May this link will help you to achieve your requirements. They have done on php-gtk and focused on crystal reports as well.
http://datavision.sourceforge.net/

Dibyendra
Post Reply