NAME

Win32::OLE::CrystalRuntime::Application - Perl Interface to the CrystalRuntime.Application OLE Object

SYNOPSIS

The ASP Version

Dim oApp, oRpt
Set oApp = Server.CreateObject("CrystalRuntime.Application")
Set oRpt = oApp.OpenReport(vFilenameReport, 1)
oRpt.DisplayProgressDialog = False
oRpt.MorePrintEngineErrorMessages = False
oRpt.EnableParameterPrompting = False
oRpt.DiscardSavedData
oRpt.ExportOptions.DiskFileName = vFilenameExport
oRpt.ExportOptions.FormatType = 31                  '31=>PDF
oRpt.ExportOptions.DestinationType = 1              '1=>filesystem
oRpt.ExportOptions.PDFExportAllPages = True
oRpt.Export(False)
Set oRpt = Nothing
Set oApp = Nothing

The perl Version

use Win32::OLE::CrystalRuntime::Application;
my $application=Win32::OLE::CrystalRuntime::Application->new;
my $report=$application->report(filename=>$filename);
$report->setParameters(key1=>$value1, key2=>$value2);
$report->export(format=>"pdf", filename=>"export.pdf");

DESCRIPTION

This package allows automation of generating Crystal Reports with Perl. This package connects to the Crystal Runtime Application OLE object provided by craxddrt.dll (Crystal Reports ActiveX Designer Design and Runtime Library). You MUST have a license for the Crystal Reports server-side component "Report Designer Control (RDC)" in order for this to work.

                                             Perl API       
                                                |           
                                      +--------------------+
          Perl API                 +---------------------+ |
             |                  +----------------------+ | |
+---------------------------+ +----------------------+ | | |
|                           | |                      | | | |
|  Perl Application Object  | |  Perl Report Object  | | | |
|                           | |                      | | | |
|       "ole" method        | |     "ole" method     | | | |
|     +==============+      +-+   +==============+   | | | |
|     |              |      | |   |              |   | | | |
|     |  Win32::OLE  |      | |   |  Win32::OLE  |   | | | |
|     |  Application |============|    Report    |   | | | |
|     |    Object    |      | |   |    Object    |   | | |-+
|     |              |      | |   |              |   | |-+
|     +==============+      | |   +==============+   |-+
+---------------------------+ +----------------------+ 

USAGE

use Win32::OLE::CrystalRuntime::Application;
my $application=Win32::OLE::CrystalRuntime::Application->new(debug=>4);
my $report=$application->report(filename=>$filename);
$report->setConnectionProperties("Server"   => "TNSNAME",        #if needed
                                 "User ID"  => "MyAccount",
                                 "Password" => "MyPassword",
                                 "Schema"   => "MySchema");
$report->setParameters($key1=>$value1, $key2=>$value2);          #if needed
$report->export(format=>"pdf", filename=>"export.pdf");

CONSTRUCTOR

new

my $application=Win32::OLE::CrystalRuntime::Application->new(
                  ProgramID=>"CrystalRuntime.Application", #default
                );

my $application=Win32::OLE::CrystalRuntime::Application->new(
                  ProgramID=>"CrystalRuntime.Application.11", #require version 11
                );

METHODS

ProgramID

Set and returns the Program ID which defaults to "CrystalRuntime.Application".

my $string=$application->ProgramID;

You may want to specify the version if you have multiple objects in your environment.

$application->ProgramID("CrystalRuntime.Application.11");  #Require version 11

ole

Set or Returns the OLE Application object. This object is a Win32::OLE object that is created with a Program ID of "CrystalRuntime.Application"

report

Constructs a report object which is a Win32::OLE::CrystalRuntime::Application::Report.

my $report=$application->report(filename=>$filename);

METHODS (OLE Wrappers)

GetVersion

Returns the Version of Craxddrt.dll (Crystal Reports ActiveX Designer Design and Runtime Library)

printf "GetVersion = %s.\n", $application->GetVersion;

Example: GetVersion = 8964.

BUGS

Log on RT and contact the Author.

SUPPORT

DavisNetworks.com supports all Perl applications including this package.

Trouble Shooting

perl -MWin32::OLE -e "Win32::OLE->CreateObject(q{CrystalRuntime.Application}); print Win32::OLE->LastError, qq{\n}"

Note: This package has only been tested on Crystal Report Server X1R2 on Windows Server 2003.

Error: 'perl' is not recognized as an internal or external command,

Resolution: Install Perl. I run ActiveState Perl 5.10 which has DBD::Oracle drivers.

Error: Can't locate Win32/OLE.pm in @INC

Resolution: Install Win32::OLE.

Error: Win32::OLE(0.1709) error 0x800401f3: "Invalid class string"

Resolution: Install Crystal Runtime Application OLE object provided by craxddrt.dll (Crystal Reports ActiveX Designer Design and Runtime Library) which is available in their server product and certain developer products.

AUTHOR

Michael R. Davis
CPAN ID: MRDVT
STOP, LLC
domain=>stopllc,tld=>com,account=>mdavis
http://www.stopllc.com/

COPYRIGHT

This program is free software licensed under the...

The BSD License

The full text of the license can be found in the LICENSE file included with this module.

SEE ALSO

Crystal Reports XI Technical Reference Guide - http://support.businessobjects.com/documentation/product_guides/boexi/en/crxi_Techref_en.pdf

Win32::OLE, Win32::OLE::CrystalRuntime::Application::Report