Win32::OLE::CrystalRuntime::Application::Report - Perl Interface to the Crystal Report OLE Object
use Win32::OLE::CrystalRuntime::Application; my $application=Win32::OLE::CrystalRuntime::Application->new; my $report=$application->report(filename=>$filename); $report->export(format=>"pdf", filename=>"export.pdf");
This package is a wrapper around the OLE object for a Crystal Report.
You must construct this object from a Win32::OLE::CrystalRuntime::Application object as the ole object is constructed at the same time and is generated from the application->ole object.
use Win32::OLE::CrystalRuntime::Application; my $application=Win32::OLE::CrystalRuntime::Application->new; my $report=$application->report(filename=>$filename); Perl API | +--------------------+ Perl API +---------------------+ | | +----------------------+ | | +---------------------------+ +----------------------+ | | | | | | | | | | | Perl Application Object | | Perl Report Object | | | | | | | | | | | | "ole" method | | "ole" method | | | | | +==============+ +-+ +==============+ | | | | | | | | | | | | | | | | | Win32::OLE | | | | Win32::OLE | | | | | | | Application |============| Report | | | | | | | Object | | | | Object | | | |-+ | | | | | | | | |-+ | +==============+ | | +==============+ |-+ +---------------------------+ +----------------------+
Returns the name of the report filename. This value is read only after object construction.
my $filename=$report->filename;
Set on construction
my $report=Win32::OLE::CrystalRuntime::Application::Report->new( filename=>$filename, );
Returns the OLE report object. This object is the Win32::OLE object that was constructed during initialization from the $application->report() method.
Returns the application object.
my $application=$report->application;
Set on construction in the $application->report method.
my $report=Win32::OLE::CrystalRuntime::Application::Report->new( application=>$application );
Sets report ConnectionProperties correctly in the correct order.
$report->setConnectionProperties("Server" => "TNSNAME", "User ID" => "login", "Password" => "password");
Sets report ConnectionProperties correctly in the correct order and set Schema for tables.
$report->setConnectionProperties("Server" => "TNSNAME", "User ID" => "login", "Password" => "password", "Schema" => "schematxt");
Tables where you do not want to reset the schema alias them with a "_" (e.g. 'SELECT 1 FROM SYS.DUAL "_DUAL"').
Current Limitations: Oracle support for crdb_oracle.dll only Current Limitations: SubReports are only searched one level deep; not recursive.
See Also: Schema Helpers Section
Sets the report parameters.
$report->setParameters($key1=>$value1, $key2=>$value2, ...); #Always pass values as strings and convert in report $report->setParameters(%hash);
Saves the report in the specified format to the specified filename.
$report->export(filename=>"report.pdf"); #default format is pdf $report->export(format=>"pdf", filename=>"report.pdf"); $report->export(formatid=>31, filename=>"report.pdf"); #pass format id directly
Returns a hash of common format extensions and CRExportFormatType IDs. Other formats are supported with export(formatid=>$id)
my $hash=$report->FormatID; #{pdf=>31, xls=>36}; my @orderedlist=$report->FormatID; #(pdf=>31, xls=>36, ...) my $id=$report->FormatID->{"pdf"}; #$ i.e. 31
String. Gets the report author.
String. Gets report comments.
String. Gets the report subject.
String. Gets the report template.
String. Gets the report title.
String. Gets the keywords in the report.
Long. Gets the number of groups in the report.
String. Gets SQL query string.
Returns a list of all tables in the report.
my $list=$report->tables; #[] my @list=$report->tables; #()
Returns a list of all sections in the report.
my $list=$report->sections; #[] my @list=$report->sections; #()
Returns a list of all objects in all sections of the report.
my $list=$report->objects; #[] my @list=$report->objects; #()
Returns a list of all objects of type CRObjectKind in all sections of the report.
my $list=$report->objects(type=>5); #[] #crSubreportObject my @list=$report->objects(type=>1); #() #crFieldObject
Returns all OLE subreports in the report
Note: This is currently only one level deep and not recursive!!!
Schema Helpers are only used if you set the "Schema" property in the setConnectionProperties method.
When moving a Crystal Report rpt file among development, alpha and production database typically the schema changes. These functions will help you redefine the schemas so that you can develop a report against a development database, test the same report against an alpha database, and deploy the same exact report to production.
These helpers trigger from the prefix of the table alias since the schema is not available from the runtime OLE object.
Set the trailing part of the schema on these schemas. This is popular for alias or "shadow" type schema configurations.
Default: "SHADOW_"
Example: "SELECT * FROM SHADOW_DEV1.TABLE1 _pre_table1" becomes "SELECT * FROM SHADOW_PROD1.TABLE1 _pre_table1"
Set the leading part of the schema on these schemas. This is popular for alias or "shadow" type schema configurations.
Default: "_SHADOW"
Example: "SELECT * FROM DEV1_SHADOW.TABLE1 _post_table1" becomes "SELECT * FROM PROD1_SHADOW.TABLE1 _post_table1"
Token used in the table alias
Default: "_pre_"
$report->shadow_schema_prefixed_token("_token_");
Example: "SELECT * FROM SHADOW_DEV1.TABLE _token_table1" becomes "SELECT * FROM SHADOW_PROD1.TABLE _token_table1"
Default: "_post_"
$report->shadow_schema_postfixed("_DAPI"); $report->shadow_schema_postfixed_token("_dapi_");
Example: "SELECT * FROM DEV1_DAPI.TABLE1 _dapi_table1" becomes "SELECT * FROM PROD1_DAPI.TABLE1 _dapi_table1"
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.
Win32::OLE::CrystalRuntime::Application, Win32::OLE::CrystalRuntime::Application::Base, Win32::OLE, Win32::OLE::Variant
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.