Win32::OLE::CrystalRuntime::Application - Perl Interface to the CrystalRuntime.Application OLE Object
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");
This package allows automation of generating Crystal Reports with Perl. This package connects to the Crystal Runtime Application OLE object. You MUST have a license for the Crystal Reports server-side component 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 | | | |-+ | | | | | | | | |-+ | +==============+ | | +==============+ |-+ +---------------------------+ +----------------------+
use Win32::OLE::CrystalRuntime::Application; my $application=Win32::OLE::CrystalRuntime::Application->new; my $report=$application->report(filename=>$filename); foreach my $index (1 .. $report->ole->Database->Tables->Count) { if ($report->ole->Database->Tables->Item($index)->DllName eq "crdb_oracle.dll") { $report->ole->Database->Tables->Item($index)->ConnectionProperties("Server")->{'Value'} = $database; $report->ole->Database->Tables->Item($index)->ConnectionProperties("User ID")->{'Value'} = $account; $report->ole->Database->Tables->Item($index)->ConnectionProperties("Password")->{'Value'} = $password; } } $report->setParameters($key1=>$value1, $key2=>$value2); $report->export(format=>"pdf", filename=>"export.pdf");
my $application=Win32::OLE::CrystalRuntime::Application->new( ProgramID=>"CrystalRuntime.Application", #default );
Returns the Program ID which defaults to "CrystalRuntime.Application". You may want to specify the version if you have multiple objects in your environment.
$application->ProgramID;
Set or Returns the OLE Application object. This object is a Win32::OLE object that is created with a Program ID of "CrystalRuntime.Application"
Constructs a report object which is a Win32::OLE::CrystalRuntime::Application::Report.
my $report=$application->report(filename=>$filename);
Please try Business Objects.
Michael R. Davis CPAN ID: MRDVT STOP, LLC domain=>stopllc,tld=>com,account=>mdavis http://www.stopllc.com/
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.
Crystal Reports XI Technical Reference Guide - http://support.businessobjects.com/documentation/product_guides/boexi/en/crxi_Techref_en.pdf
Win32::OLE
To install Win32::OLE::CrystalRuntime::Application, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Win32::OLE::CrystalRuntime::Application
CPAN shell
perl -MCPAN -e shell install Win32::OLE::CrystalRuntime::Application
For more information on module installation, please visit the detailed CPAN module installation guide.