Link to home
Start Free TrialLog in
Avatar of charlesparks
charlesparks

asked on

PHP / Crystal Reports 12

I am attempting to use a script I found to work with my application and some reports I have created in Crystal Reports 12.

  I get the following error when trying to load.

Fatal error: Uncaught exception 'com_exception' with message 'Failed to create COM object `CrystalRuntime.Application12': Invalid syntax ' in C:\xampp\htdocs\salesroomtools\crystal.php:2 Stack trace: #0 C:\xampp\htdocs\salesroomtools\crystal.php(2): com->com('CrystalRuntime....') #1 {main} thrown in C:\xampp\htdocs\salesroomtools\crystal.php on line 2


Any Ideas?!  I can create new com objects with other applications without error...
<?php

$crapp = new com("CrystalRuntime.Application.12") or die ("Error on load");
$creport = $crapp->OpenReport("c:/test.rpt", 1);
$creport->ExportOptions->DiskFileName="c:/test.rtf";
$creport->ExportOptions->DestinationType=1; // Export to File
$creport->ExportOptions->FormatType=4; // Type: RTF
$creport->DiscardSavedData();
$creport->Export(false);

$creport = null;
$crapp = null;

print "...done";

?>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Richard Quadling
Richard Quadling
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
The example code I supplied works fine for Crystal Reports XI. It was based upon details gathered from the COM library by the use of the TypeLib browser tool.

Without feedback, I don't know if the code will work on CR 12 without modification.