No part of this documentation may be stored in a retrieval system, transmitted or
reproduced in any way, except in accordance with the terms of the applicable
software license agreement. This documentation contains proprietary information
of Business Objects SA., and/or its suppliers.
Trademark Acknowledgements
The Business Objects logo, BusinessObjects, Crystal Reports, and Crystal
Enterprise are trademarks or registered trademarks of Business Objects SA in the
United States and/or other countries. All other trademarks or registered
trademarks referenced are the property of their respective owners.
Contents
Chapter 1: Welcome to Crystal Reports Development
About Crystal Reports ....................................................................... 4
About the online help ....................................................................... 4
Deprecated RDC Export Format Types ......................................... 474
viCrystal Reports Technical Reference Guide
Crystal Reports Technical Reference Guide1
2Crystal Reports Technical Reference Guide
1 Welcome to Crystal Reports Development
Welcome to Crystal Reports
Development1
Welcome! This section introduces you to developing with
Crystal Reports, the world standard for desktop and web
reporting, and provides you with an overview of the
contents of this online help.
Click the appropriate link to jump to that section:
• About Crystal Reports
• About the online help
• Product registration
• Customer Handbook
• Crystal Care technical support
• Crystal Training
• Crystal Consulting
• Document conventions
Additional Resources
The Crystal Reports User’s Guide is available in PDF format on the install CD in the
Documentation folder (UserGde.pdf). The contents of the Crystal Reports Online Help (crw.chm) includes everything from the printed manual, plus more.
Crystal Decisions Support web site
The Crystal Decisions Support web site, which serves as an extension of all Crystal
Decisions products, is the place to go for product support, samples, educational
documents, tutorials, tools, forums, and more:
http://support.crystaldecisions.com
Crystal Decisions Developers Zone
The Crystal Decisions Developers zone is the key place for the latest development
news. Updated weekly, you will find this an invaluable resource on the latest
features, issues, and tips and tricks.
http://www.crystaldecisions.com/products/dev_zone
Crystal Reports Technical Reference Guide3
About Crystal Reports
About Crystal Reports
Crystal Reports is designed to work with your database to help you analyze and
interpret important information. Crystal Reports makes it easy to create simple
reports; it also has the comprehensive tools you need to produce complex or
specialized reports.
Create any report you can imagine
Crystal Reports is designed to produce the report you want from virtually any data
source. Built-in report wizards and experts guide you step by step through
building reports and completing common reporting tasks. Formulas, cross-tabs,
subreports, and conditional formatting help make sense of data and help you
uncover important relationships that might otherwise be hidden. Geographic
maps and charts communicate information visually when words and numbers are
simply not enough.
Extend reporting to the Web
The flexibility of Crystal Reports doesn’t end with creating reports—your reports
can be published in a variety of formats including Microsoft® Word and Excel,
email, and even over the Web. Advanced Web reporting lets other members of
your workgroup view and update shared reports inside their web browser.
Incorporate reports into applications
Application and web developers can save time and meet the needs of their users
by integrating the report processing power of Crystal Reports into their database
applications. Support for most popular development languages makes it easy to
add reporting to any application.
Whether it’s the web master in IT, the promotion manager in marketing, the
database administrator in finance, or the CEO, Crystal Reports is a powerful tool
designed to help everyone analyze and interpret the information that’s important
to them.
About the online help
The online help includes technical information on the development tools included
with Crystal Reports that allow you to integrate reporting into your application.
The guide covers the Report Designer Component. It also contains tutorials and
samples that will further aid you with adding the power of Crystal Reports to your
application.
Click the appropriate link to jump to that section:
• Section contents
4Crystal Reports Technical Reference Guide
Section contents
The following is a short description of each section in the online help.
Chapter 1: Welcome to Crystal Reports Development
Welcome! This section introduces you to developing with Crystal Reports, the
world standard for desktop and web reporting, and provides you with an
overview of the contents of this online help.
Chapter 2: Report Designer Component Object Model
The Report Designer Component is the ultimate development tool for your
reporting needs. In this section you will find a detailed description of the Report
Designer Component Object Model and its properties, methods and events.
Chapter 3: Programming the Crystal Report Viewers
The Crystal Report Viewer is a front-end user interface for viewing reports. In this
section you will find detailed information on implementing the ActiveX and Java
Bean viewers in your application.
Chapter 4: Report Viewer Object Model
The Crystal Report Viewer contains an extensive object model allowing you
complete control over how the viewer appears and functions. This section
provides detailed information on the properties, methods and events of the Crystal
Report Viewer object model for both the ActiveX viewer, and the Java Bean viewer.
1 Welcome to Crystal Reports Development
Chapter 5: Programming the Embeddable Crystal Reports
Designer Control
This section demonstrates how to integrate the Embeddable Crystal Reports
Designer Control (Embeddable Designer) into your application. Included are
tutorials on creating sample applications in both Microsoft Visual Basic and
Microsoft Visual C++. A brief section on creating reports in the designer at runtime
is also included.
Chapter 6: Embeddable Crystal Reports Designer Control Object
Model
The Embeddable Crystal Reports Designer Control (Embeddable Designer) is a
new addition to the Report Designer Component; it enables you to provide a
Crystal Reports designer in your application. In this section, you will find a general
overview of the control as well as detailed information on its properties and
methods.
Crystal Reports Technical Reference Guide5
Product registration
Chapter 7: Active Data
This section provides information on using active data in the Crystal Reports
Development environment. Three areas are covered: the active data drivers, the
Crystal Data Object, and the COM Data Provider. By reading these sections you
will learn how to create active data reports, create recordsets, and connect to the
data source through the Report Designer Component automation server.
Chapter 8: Crystal Data Source Object Models
Crystal Reports provides support for reporting off data when no true data source
exists. In this section you will find detailed information, including properties and
methods, on Crystal Data Objects.
Chapter 9: Creating User-Defined Functions in C
Crystal Reports allows you to create User-Defined Functions that are recognized
by the Crystal Reports Formula Editor. In this section you will find detailed
information on programming User-Defined Functions in C.
Chapter 10: Creating User-Defined Functions in Visual Basic
Crystal Reports allows you to create User-Defined Functions that are recognized
by the Crystal Reports Formula Editor. In this section you will find detailed
information on programming User-Defined Functions in Microsoft Visual Basic.
Chapter 11: Creating User-Defined Functions in Delphi 3.0
Crystal Reports allows you to create User-Defined Functions that are recognized
by the Crystal Reports Formula Editor. In this section you will find detailed
information on programming User-Defined Functions in Delphi.
Chapter 12: Deprecated and Retired API Reference
The following developer APIs, interfaces, methods, and properties are retired or
deprecated. Retired features are no longer available or supported. Deprecated
features, while they may be supported for backwards compatibility, are not
recommended for use in the current version of Crystal Reports. Deprecated
features may become obsolete in future versions of the product.
Product registration
There are several ways you can register your product:
• Fill out the Product Registration form on the Crystal Decisions web site at:
http://www.crystaldecisions.com/register/
6Crystal Reports Technical Reference Guide
• Print the Product Registration form and fax it to the registration fax number
closest to you. Crystal Decisions will then fax you a registration number that
can be entered into the product the next time you use it.
Registration fax numbers
USA/Canada +1 (604) 681-5147
United Kingdom +44 (0) 20 8231 0601
Australia +6 2 9955 7682
Germany +49 (0) 69 9509 6182
Hong Kong +852 2893 2727
Singapore +65 777 8786
Registering the product ensures that you are kept up-to-date with product
advancements.
Customer Handbook
For the latest details about product registration, maintenance, support, and
services, visit our web site and download the Customer Handbook that
corresponds to your region:
If a Crystal Decisions Customer Handbook is not available for your region, please
refer to the rest of this Welcome chapter, or contact your sales or support
representative for complete details.
1 Welcome to Crystal Reports Development
(German)
Crystal Care technical support
To access Crystal technical support specialists, you must: register your software
online at:
http://www.crystaldecisions.com/register/
To find out about the technical support programs available for Crystal Reports:
• Go to our support web site at:
http://support.crystaldecisions.com/crystalcare/
• Contact your regional office. For details, go to:
Whether you’re a developer, information technology professional, or business
user, we offer a wide range of Crystal Reports training courses designed to build
or enhance your existing skills. Courses are available online, at certified training
centers, or at your own site:
• For a complete list of training courses and special offers, visit:
http://www.crystaldecisions.com/training/
• Or contact your regional office. For details, go to:
http://www.crystaldecisions.com/offices/
Crystal Consulting
Our global team of certified consultants and consulting partners can guide you
through a corporate-wide solution—including strategy, design, integration and
deployment—for the fastest results, maximum performance, and increased
productivity.
• To learn more, visit:
http://www.crystaldecisions.com/consulting/
• Or contact your regional office. For details, go to:
http://www.crystaldecisions.com/offices/
Document conventions
This online help uses the following conventions:
• Commands and buttons
For easy recognition within procedures, User Interface (UI) features appear in
bold type. For example: On the File menu, click New.
• Keyboard shortcuts
Delete means the Delete key, or the Del key on your numeric keypad. Enter
means the Enter, Return, or CR key, depending on which of these keys appears
on your keyboard.
• Key combinations
CTRL+KEY, SHIFT+KEY, and ALT+KEY are examples of key combinations.
Hold down the first key in the combination and, at the same time, press the
second key in the combination (designated above as KEY). For example:
CTRL+C means hold the Control key down and press the letter C on your
keyboard (CTRL+C is the Windows Copy command).
• Key terms are italicized when first defined.
• Monospaced font indicates file paths and names, lines of code, and data that
you enter using your keyboard (for example: In the Formula Editor, type
Sales > 1000 Then crRed
8Crystal Reports Technical Reference Guide
).
If
1 Welcome to Crystal Reports Development
• Monospaced, italicized font indicates variable data that you must replace with
data appropriate to your current settings, environment, or task. For example,
in the following URL, you would replace
http://
webserver
/crystal/enterprise/
webserver:
Crystal Reports Technical Reference Guide9
Document conventions
10Crystal Reports Technical Reference Guide
Report Designer Component Object
Model2
The Report Designer Component is the ultimate
development tool for your reporting needs. In this section
you will find a detailed description of the Report Designer
Component Object Model and its properties, methods, and
events.
Click the appropriate link to jump to that section:
• Overview of the Report Designer Object Model
• Unification of the RDC object model
• Runtime licensing
• Object naming conflicts
• Objects and Collections
• Creatable Objects
• Application Object
• Area Object
• Areas Collection
• BlobFieldObject Object
• BoxObject Object
• ConnectionProperty Object
• ConnectionProperties Collection
• CrossTabGroup Object
• CrossTabGroups Collection
• CrossTabObject Object
• Database Object
• DatabaseFieldDefinition Object
• DatabaseFieldDefinitions Collection
• DatabaseTable Object
• DatabaseTables Collection
• ExportOptions Object
• FieldDefinitions Collection
• FieldElement Object
• FieldElements Collection
Crystal Reports Technical Reference Guide11
• FieldMappingData Object
• FieldObject Object
• FormattingInfo Object
• FormulaFieldDefinition Object
• FormulaFieldDefinitions Collection
• GraphObject Object
• GroupNameFieldDefinition Object
• GroupNameFieldDefinitions Collection
• LineObject Object
• MapObject Object
• ObjectSummaryFieldDefinitions Collection
• OlapGridObject Object
• OleObject Object
• Page Object
• PageEngine Object
• PageGenerator Object
• Pages Collection
• ParameterFieldDefinition Object
• ParameterFieldDefinitions Collection
• ParameterValue Object
• ParameterValues Collection
• ParameterValueInfo Object
• ParameterValueInfos Collection
• PrintingStatus Object
• Report Object
• ReportAlert Object
• ReportAlerts Collection
• ReportAlertInstance Object
• ReportAlertInstances Collection
• ReportObjects Collection
• RunningTotalFieldDefinition Object
• RunningTotalFieldDefinitions Collection
• Section Object
• Sections Collection
• SortField Object
• SortFields Collection
• SpecialVarFieldDefinition Object
• SQLExpressionFieldDefinition Object
• SQLExpressionFieldDefinitions Collection
• SubreportLinks Collection
• SubreportObject Object
• SummaryFieldDefinition Object
12Crystal Reports Technical Reference Guide
• SummaryFieldDefinitions Collection
• TableLink Object
• TableLinks Collection
• TextObject Object
• Examples
• Enumerated Types
2 Report Designer Component Object Model
Crystal Reports Technical Reference Guide13
Overview of the Report Designer Object Model
Overview of the Report Designer Object Model
14Crystal Reports Technical Reference Guide
2 Report Designer Component Object Model
Please review the following comments regarding Object naming conflicts.
Unification of the RDC object model
Craxddrt.dll (Crystal Reports ActiveX Designer Design and Runtime Library) is a
unified object model that combines the runtime capabilities of the Craxdrt.dll
(Crystal Reports ActiveX Designer Run Time Library) with the design time
capabilities of the Craxddt.dll (Crystal Reports ActiveX Designer Design Time
Library). Craxddrt.dll will replace Craxddt.dll for versions 8.5 and up. Both the
Craxddrt.dll and the Craxdrt.dll contain all the objects and associated methods,
properties, and events needed for creating, opening, exporting, saving, and
printing a report at run time. In addition, Craxddrt.dll is either used with the RDC
ActiveX Designer when designing reports at design time, or used with the
Embeddable Designer when designing reports at run time. See “Embeddable
Crystal Reports Designer Control Object Model” on page 381 for more
information.
Note: The RDC ActiveX Designer is only available in Microsoft Visual Basic.
Prior to version 8.5, the Craxdrt.dll would be distributed with an application. Now
the developer has a choice of two automation servers to distribute. Craxdrt.dll is
backwards-compatible with previous versions and contains all the features
introduced in this version. Use the Craxdrt.dll for any client-side application that
does not contain the Embeddable Designer, or use it for any server-side
application. Craxddrt.dll is apartment-model threaded, but is not thread safe, and
can only be used in a client-side application. Although the Craxddrt.dll is a fully
functional automation server for the RDC, and can work in any client-side
application, it will increase the install size. Therefore, it is recommended that you
only use Craxddrt.dll with the Embeddable Crystal Reports Designer Control.
Runtime licensing
Your Crystal Reports developer edition license provides the rights to distribute
software applications that use or embed most files and functionality of the product,
free of charge. In addition, your Crystal Reports developer edition contains
features that provide a great deal of flexibility and power for developers to embed
reporting into their applications. These runtime report creation features may only
be used and distributed if the appropriate licensing is obtained from Crystal
Decisions by paying the required royalty fees. Please refer to the License Manager Help (License.hlp) for lists of features that are royalty-free and royalty-required.
Object naming conflicts
If your project includes other libraries that contain objects named identical to those
found in the Crystal Report Engine Object Library, you will encounter conflicts
Crystal Reports Technical Reference Guide15
Objects and Collections
unless you reference the objects using a prefix. For example, if you have included
the DAO Library with the Crystal Report Engine Object Library in your project,
both libraries include a Database Object. In order to avoid conflicts, you must
prefix the objects as follows:
CRAXDRT.Database
for the Crystal Report Engine Object Library, or
DAO.Database
for the DAO Library.
Objects and Collections
The following Objects and Collections, listed alphabetically, are discussed in this
section. Properties, Methods, and Events are listed under the appropriate Object or
Collection.
Note: Some of the report creation calls are not included in the free runtime license
included with Crystal Reports. For a list of calls that require additional licensing,
please see the License Manager Help (License.hlp).
Creatable Objects
There are several Crystal Reports objects which can be created by passing their
Prog Ids into the CreateObject function provided by Visual Basic. The table below
lists these objects.
Note: The version number can be appended to the Prog Id (for example,
CrystalRuntime.ParameterValue.10). If the version number is not specified,
CreateObject will create the object using the most recently installed version of
craxdrt.dll
16Crystal Reports Technical Reference Guide
.
Application Object
An instance of the Application object can be created using the Visual Basic New
keyword or the CreateObject function and the Prog Id
CrystalRuntime.Application.10. For example:
• Using the New keyword
Dim app as New CRAXDRT.Application
Set app = New CRAXDRT.Application
Or,
' Automatically creates a new instance of the object when it is first
' referenced in the code, so it doesn’t have to be set.
Dim app as New Application
• Using the CreateObject function
' If the version number of the application is not specified, CreateObject
' will create an application running against the most recently installed
‘ version of craxdrt.dll
Dim app As Application
Set app = CreateObject(“CrystalRuntime.Application”)
Or,
2 Report Designer Component Object Model
' Specify the version number to require version 8.5 of the dll.
Dim app As Application
Set app = CreateObject(“CrystalRuntime.Application.8.5”)
Click Application Object Methods to continue.
Application Object Methods
The following methods are discussed in this section:
• “CanClose Method (Application Object)” on page 18
• “GetLicenseStatus Method (Application Object)” on page 18
• “GetVersion Method (Application Object)” on page 18
• “LogOffServer Method (Application Object)” on page 19
• “LogOnServer Method (Application Object)” on page 20
• “LogOnServerEx Method (Application Object)” on page 21
• “NewReport Method (Application Object)” on page 22
• “OpenReport Method (Application Object)” on page 22
• “SetMatchLogOnInfo Method (Application Object)” on page 23
Crystal Reports Technical Reference Guide17
Application Object
CanClose Method (Application Object)
The CanClose method indicates whether or not the “Application Object” can be
destroyed. This method will return FALSE as long as there are valid Report objects
in existence and at least one Report Object is in the printing-in-progress state. The
Application object can only be destroyed if no instances of the “Report Object” are
in the printing-in-progress state. If you obtain a Report object directly from the
Report Designer Component added to your project at design time, then CanClose
will always return False until you destroy that object (usually by setting it equal to
Nothing).
Syntax
Function CanClose () As Boolean
Returns
• TRUE if the Engine can be closed.
• FALSE if the Engine is busy.
GetLicenseStatus Method (Application Object)
The GetLicenseStatus method is used to get the license number of the Report
Creation API License and the current count of licenses in use.
Syntax
GetLicenseStatus(pMaxLicenseNumber, pLicenseUsed) As Boolean
Returns
• True if the license is active and the pLicenseUsed parameter was used in the
call.
• False if the license is not active and the pLicenseUsed parameter was used in
the call.
GetVersion Method (Application Object)
The GetVersion method returns an integer that, when converted to hex, represents
the version number of the dll.
Syntax
Function GetVersion () As Integer
18Crystal Reports Technical Reference Guide
2 Report Designer Component Object Model
Returns
• Returns an integer that represents the version number of the dll when
converted to hexidecimal.
Sample
'Display the version number in a text box.
Text1.text = Hex(CRXApplication.GetVersion)
LogOffServer Method (Application Object)
The LogOffServer method logs off an SQL server or other data sources such as
ODBC or OLEDB provider. Use this method when you have logged on to the data
source using “LogOnServer Method (Application Object)”.
Syntax
Sub LogOffServer (pDllName As String, pServerName As String,
[pDatabaseName], [pUserID], [pPassword])
Parameters
Table 1:
ParameterDescription
pDLLNameSpecifies the name of the DLL for the server or password protected non-SQL
table you want to log on to, for example “P2SODBC.DLL”. Note that the
DLLName must be enclosed in quotes. DLL names have the following
naming convention: P2B*.DLL for standard (non-SQL) databases, P2S*.DLL
for SQL/ODBC databases.
pServerNameSpecifies the log on name for the server used to create the report. (For
[pDatabaseName]Specifies the name for the database used to create the report. See Remarks
[pUserID]Specifies the User ID number necessary to log on to the server. See Remarks
[pPassword]Specifies the password necessary to log on to the server.
Crystal Reports Technical Reference Guide19
ODBC, use the data source name.) This value is case-sensitive. See Remarks
below.
below.
below.
Application Object
Remarks
• For parameters pServerName, pDatabaseName, and pUserId, pass an empty
string (“”) to preserve the existing setting or pass a non-empty string (for
example, “Server A”) to override a value that is already set in the report.
• If you try to log off a server that is still in use (i.e., there is an object variable
still in focus that holds reference to a report that requires being logged on to
the server to access data) you will be unable to log off. This will apply to every
object that comes from the “Report Object”, as they all hold reference to the
report through their respective Report properties.
• If you assign the Report object to the ReportSource property of the “CRViewer
Object (CRVIEWERLib)”, in the Crystal Reports Report Viewer, enabling the
report to be displayed through the Report Viewer, you cannot call
LogOffServer for the report until you assign a new report to the Report Viewer
or close the CRViewer object.
LogOnServer Method (Application Object)
The LogOnServer method logs on to an SQL server or other data sources such as
ODBC. Once logged on using this method, you will remain logged on until you call
“LogOffServer Method (Application Object)”, or until the “Application Object”, is
destroyed and craxdrt.dll is unloaded.
Syntax
Sub LogOnServer (pDllName As String, pServerName As String,
[pDatabaseName], [pUserID], [pPassword])
Parameters
Table 2:
ParameterDescription
pDLLNameSpecifies the name of the DLL for the server or password protected non-
SQL table you want to log on to, for example “P2SODBC.DLL”. Note that
the dllName must be enclosed in quotes. DLL names have the following
naming convention: P2B*.DLL for standard (non-SQL) databases, P2S*.DLL
for SQL/ODBC databases.
pServerNameSpecifies the log on name for the server used to create the report. (For
[pDatabaseName] Specifies the name for the database used to create the report. See Remarks
20Crystal Reports Technical Reference Guide
ODBC, use the data source name.) This value is case-sensitive. See Remarks
below.
below.
2 Report Designer Component Object Model
Table 2:
ParameterDescription
[pUserID]Specifies the User ID number necessary to log on to the server. See Remarks
below.
[pPassword]Specifies the password necessary to log on to the server.
*When you pass an empty string (““) for this parameter, the program uses the
value that’s already set in the report. If you want to override a value that’s already
set in the report, use a non-empty string (that is, “Server A”).
Remarks
For parameters pServerName, pDatabaseName, and pUserId, pass an empty
string (“”) to preserve the existing setting or pass a non-empty string (for example,
“Server A”) to override a value that is already set in the report.
LogOnServerEx Method (Application Object)
The LogOnServer method logs on to an SQL server or other data sources such as
ODBC. Using LogOnServerEx, you can pass server type or connection
information. Once logged on using this method, you will remain logged on until
you call “LogOffServer Method (Application Object)”, or until the “Application
Object”, is destroyed and craxdrt.dll is unloaded.
Syntax
Sub LogOnServerEx (pDllName As String, pServerName As String,
[pDatabaseName], [pUserID], [pPassword],
[pServerType], [pConnectionString])
Parameters
Table 3:
ParameterDescription
pDLLNameSpecifies the name of the DLL for the server or password protected non-
SQL table you want to log on to, for example “P2SODBC.DLL”. Note that
the dllName must be enclosed in quotes. DLL names have the following
naming convention: P2B*.DLL for standard (non-SQL) databases,
P2S*.DLL for SQL/ODBC databases.
Crystal Reports Technical Reference Guide21
Application Object
Table 3:
ParameterDescription
pServerNameSpecifies the log on name for the server used to create the report. (For
ODBC, use the data source name.) This value is case-sensitive. See
Remarks below.
[pDatabaseName]Specifies the name for the database used to create the report. See
Remarks below.
[pUserID]Specifies the User ID number necessary to log on to the server. See
[pPassword]Specifies the password necessary to log on to the server.
[pServerType]Specifies the database Server Type.
[pConnectionString]Specifies the connection string.
Remarks below.
NewReport Method (Application Object)
The NewReport method creates a new empty Report Object.
Syntax
Function NewReport () As Report
Returns
• Returns a new empty Report Object.
OpenReport Method (Application Object)
The OpenReport method opens an existing report file, creating an instance of the
Report object. Through the “Report Object”, you can change formatting, formulas,
selection formulas, and sort fields for the report, then print, preview, or export the
report.
Syntax
Function OpenReport (pFileName As String, [OpenMethod]) As Report
22Crystal Reports Technical Reference Guide
2 Report Designer Component Object Model
Parameters
Table 4:
ParameterDescription
pFileNameSpecifies a string value indicating the file name and path of
the report that you want to open.
OpenMethod“CROpenReportMethod”. Specifies whether you want to
open the report exclusively. If you do not provide this
parameter the report is opened exclusively and it cannot be
opened a second time.
Returns
• Returns an instance of the “Report Object” if the report was successfully
opened.
• Returns 0 if the report file does not exist or if an error occurs.
Remarks
• The OpenMethod parameter can take the values “0” (open by default) or “1”
(open temporary copy). If you open a report as a temporary copy (“1”), you
must save the report using the SaveAs Method (Report Object) rather than the
Embeddable Designer’s SaveReport Method in order to avoid a runtime error.
SetMatchLogOnInfo Method (Application Object)
The SetMatchLogOnInfo Method sets global match log on info option, matching
the log on password.
Syntax
Sub SetMatchLogOnInfo (bl As Boolean)
Parameter
Table 5:
ParameterDescription
blSpecifies whether the option is selected (TRUE).
Crystal Reports Technical Reference Guide23
Area Object
Area Object
The Area Object represents an area in a report. An area is a group of like sections
in the report (i.e., Details A - Da, Details B - Db, etc.) that all share the same
characteristics. Each section within the area can be formatted differently. This
object allows you to retrieve information and set options for a specified area in
your report.
Area Object Properties
Ta b le 6:
PropertyDescription
ConditionFormulaString. Gets or sets the condition formula.
The condition formula can be based on
recurring records or on summary fields,
but it cannot be based on print-time
fields, such as running totals or printtime formulas. Condition formulas
cannot have shared variables.
CopiesToPrintInteger. Gets or sets the number of copies
DetailHeightLong. Gets the mailing label report detail
DiscardOtherGroupsBoolean. Gets or sets the discard other
EnableHierarchica
lGroupSorting
of each item in the Details section of the
report. For example, by default, each line
of the Details section only prints once. By
setting this to 3, each line of the Details
section would print 3 times.
area height, in twips.
area width, in twips.
groups option.
Boolean. Gets or sets group hierarchically
flag.
Read/
Write
Read
/
Wri te
Read
/
Wri te
Read
only
Read
only
Read
/
Wri te
Read
/
Wri te
Restriction in event
handler
Can be written only
when formatting
idle.
Can be written only
when formatting
idle.
None
None
Formatting idle.
GroupCondition“CRGroupCondition”. Gets or sets the
group condition.
24Crystal Reports Technical Reference Guide
Read
/
Wri te
Can be written only
when formatting
idle.
Table 6:
2 Report Designer Component Object Model
PropertyDescription
GroupConditionFi
eld
GroupIndentLong. Gets or sets group indent, in twips.Read
GroupNumberInteger. If the area is a group area, this
HideForDrillDownBoolean. Gets or sets hide for drill down
HorizontalGapLong. Gets the horizontal gaps going
InstanceIDFieldA field definition object. Gets the instance
KeepGroupTogetherBoolean. Gets or sets the keep group
KeepTogetherBoolean. Gets or sets the keep area
Object. Gets or sets the group condition
field.
returns the group number. Otherwise,
exception is thrown.
option.
across page in a multiple column report.
ID field. See Remarks.
together option.
together option.
Read/
Write
Read
/
Wri te
/
Wri te
Read
only
Read
/
Wri te
Read
only
Read
only
Read
/
Wri te
Read
/
Wri te
Restriction in event
handler
Can be written only
when formatting
idle.
Formatting idle.
None
Can be written only
when formatting
idle.
None
Formatting idle.
Can be written only
when formatting
idle.
Can be written only
when formatting
idle.
Kind“CRAreaKind”. Gets which kind of area
(for example, Details, Report Header,
Page Footer, etc.).
NameString. Gets or sets the area name.Read
NewPageAfterBoolean. Gets or sets the new page after
options.
NewPageBeforeBoolean. Gets or sets the new page before
option.
Crystal Reports Technical Reference Guide25
Read
only
/
Wri te
Read
/
Wri te
Read
/
Wri te
None
Can be written only
when formatting
idle.
Can be written only
when formatting
idle.
Can be written only
when formatting
idle.
Area Object
Ta b le 6:
PropertyDescription
NumberOfTopOr
BottomNGroups
Parent“Report Object”. Gets reference to the
ParentIDFieldA field definition object. Gets the parent
PrintAtBottomOfP
age
RepeatGroupHea
der
ResetPageNumber
After
Sections“Sections Collection”. Gets a Collection
SortDirection“CRSortDirection”. Gets or sets the group
Integer. Gets or sets the number of top or
bottom groups.
parent object.
ID field. See Remarks.
Boolean. Gets or sets the print at bottom
of page option.
Boolean. Gets or sets the repeating group
header option.
Boolean. Gets or sets the reset page
number after option.
of all the sections in the area.
sort direction.
Read/
Write
Read
/
Wri te
Read
Only
Read
only
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Read
Only
Read
/
Wri te
Restriction in event
handler
Formatting idle.
None
Formatting idle.
Can be written only
when formatting
idle.
Can be written only
when formatting
idle.
Can be written only
when formatting
idle.
None
Can be written only
when formatting
idle.
SpecifiedGroupsGets or sets the specified groups.Read
/
Wri te
SuppressBoolean. Gets or sets the area visibility.Read
/
Wri te
TopOrBottomNGr
oupSortOrder
TopOrBottomNSo
rtField
26Crystal Reports Technical Reference Guide
“CRTopOrBottomNGroupSortOrder”.
Gets or sets the top or bottom N group
sort order.
“SummaryFieldDefinition Object”. Gets
or sets the top or bottom n sort field.
Read
/
Wri te
Read
/
Wri te
Can be written only
when formatting
idle.
Can be written only
when formatting
idle.
Formatting idle.
Formatting idle.
Remarks
After getting the field definition object from the InstanceIDField or the
ParentIDField property, you can use the Kind property to determine what type of
field definition object it is. All field definition objects have the Kind property.
Area Object Methods
The following methods are discussed in this section:
• “SetInstanceIDField Method (Area Object)” on page 27
• “SetParentIDField (Area Object)” on page 27
SetInstanceIDField Method (Area Object)
Use the SetInstanceIDField method to set an instance ID field.
Syntax
Sub SetInstanceIDField (InstanceIDField)
Parameter
2 Report Designer Component Object Model
Table 7:
ParameterDescription
InstanceIDFieldSpecifies the instance ID field that you want to set.
SetParentIDField (Area Object)
Use the SetParentIDField method to set the parent ID field.
Syntax
Sub SetParentIDField (ParentIDField)
Parameter
Table 8:
ParameterDescription
ParentIDFieldSpecifies the parent ID field that you want to set.
Crystal Reports Technical Reference Guide27
Areas Collection
Areas Collection
The Areas Collection contains the area objects for every area in the report. Access
a specific “Area Object” in the collection using the Item property.
Areas Collection Properties
Table 9:
PropertyDescription
CountLong. Gets the number of areas in the collection.Read onlyNone
Item
(index)
Parent“Report Object”. Gets reference to the parent object.Read onlyNone
“Area Object”. Gets an item from the Collection.
Item has an index parameter that can be either a
string reference to the area (for example, “RH”,
“PH”, “GHn”, “D”, “GFn”, “PF”, or “RF”) or a
numeric, 1-based index (for example, Item (1) for the
Report Header area). The items in the collection are
indexed in the order they are listed for each section/
area.
Read/
Write
Read onlyNone
Restriction in
event handler
Remarks
Instead of using the Item property as shown, you can reference an area directly (for
example, Areas(“RH”) or Areas(1)).
BlobFieldObject Object
The BlobFieldObject Object allows you to get and set information for bitmap
database fields in a report.
28Crystal Reports Technical Reference Guide
BlobFieldObject Object Properties
Examples
How to format a blob field object
Table 10:
2 Report Designer Component Object Model
PropertyDescription
BackColorOLE_COLOR. Gets or sets the object
background color.
BorderColorOLE_COLOR. Gets or sets the object
border color.
BottomCroppingLong. Gets or sets bottom cropping size,
in twips.
BottomLineStyle“CRLineStyle”. Gets or sets the bottom
line style.
CloseAtPageBr
eak
ConditionForm
ula
Boolean. Gets or sets the close border on
page break.
String. Gets or sets the condition
formula. The condition formula can be
based on recurring records or on
summary fields, but it cannot be based
on print-time fields, such as running
totals or print-time formulas. Condition
formulas cannot have shared variables.
Read/
Write
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Restriction in event
handler
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle.
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle.
CssClassString. Gets or sets the cascading style
sheet Class.
Field“DatabaseFieldDefinition Object”. Gets
the database field definition object
containing information about the BLOB
field.
Crystal Reports Technical Reference Guide29
Read
/
Wri te
Read
only
Can be written only
when formatting idle.
None
BlobFieldObject Object
Table 10:
PropertyDescription
HasDropShadowBoolean. Gets or sets the border drop
shadow option.
HeightLong. Gets or sets the object height, in
twips.
KeepTogetherBoolean. Gets or sets the keep object
together option.
Kind“CRObjectKind”. Gets CRObjectKind
which specifies the kind of object (for
example, box, cross-tab, field, etc.).
LeftLong. Gets or sets the object upper left
position, in twips.
LeftCroppingLong. Gets or sets the left cropping size,
in twips.
LeftLineStyle“CRLineStyle”. Gets or sets the left line
style.
Read/
Write
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Read
only
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Restriction in event
handler
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle or
active.
None
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle.
Can be written only
when formatting idle or
active.
NameString. Gets or sets the object name.Read
/
Wri te
Parent“Section Object”. Gets reference to the
parent object.
RightCroppingLong. Gets or sets the right cropping
size, in twips.
RightLineStyle“CRLineStyle”. Gets or sets the right line
style.
30Crystal Reports Technical Reference Guide
Read
only
Read
/
Wri te
Read
/
Wri te
Can be written only
when formatting idle.
None
Can be written only
when formatting idle.
Can be written only
when formatting idle or
active.
Table 10:
2 Report Designer Component Object Model
PropertyDescription
SuppressBoolean. Gets or sets the object visibility.Read
TopLong. Gets or sets the object upper top
position, in twips.
TopCroppingLong. Gets or sets the top cropping size,
in twips.
TopLineStyle“CRLineStyle”. Gets or sets the top line
style.
WidthLong. Gets or sets the object width, in
twips.
XScalingDouble. Gets or sets the width scaling
factor. For example, 1 means 100%, 2
means 200%, 0.5 means 50% etc. The
scaling factor may range from 0.01 to
100.
YScalingDouble. Gets or sets the height scaling
factor. For example, 1 means 100%, 2
means 200%, 0.5 means 50% etc. The
scaling factor may range from 0.01 to
100.
Read/
Write
/
Wri te
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Restriction in event
handler
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle.
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle.
Can be written only
when formatting idle.
BoxObject Object
The Box Object represents a box that has been drawn on the report. This object
allows you to get information about boxes in a report.
Crystal Reports Technical Reference Guide31
BoxObject Object
BoxObject Object Properties
Examples
How to format a box object
Ta b le 11 :
PropertyDescription
BottomLong. Gets or sets the object
lower bottom position, in
twips.
BottomRightSection“Section Object”. Gets the
bottom right section.
CloseAtPageBreakBoolean. Gets or sets the close
border on page break option.
ConditionFormulaString. Gets or sets the
condition formula. The
condition formula can be based
on recurring records or on
summary fields, but it cannot
be based on print-time fields,
such as running totals or printtime formulas. Condition
formulas cannot have shared
variables.
CornerEllipseHeight Long. Gets or sets the corner
elipse height, in twips.
CornerEllipseWidthLong. Gets or sets the corner
elipse width, in twips.
Read/
Write
Read/
Wri te
Read
only
Read/
Wri te
Read/
Wri te
Read/
Wri te
Read/
Wri te
Restriction in event handler
Can be written only when
formatting idle.
Can be written only when
formatting idle.
Can be written only when
formatting idle.
Can be written only when
formatting idle.
CssClassString. Gets or sets the
cascading style sheet Class.
ExtendToBottomOfS
ection
Boolean. Gets or sets the
extend to bottom of section
Read/
Wri te
Read/
Wri te
Can be written only when
formatting idle.
Can be written only when
formatting idle.
option.
FillColorOLE_COLOR. Gets or sets the
fill color.
32Crystal Reports Technical Reference Guide
Read/
Wri te
Can be written only when
formatting idle.
Ta b le 11 :
2 Report Designer Component Object Model
PropertyDescription
HasDropShadowBoolean. Gets or sets the
border drop shadow option..
Kind“CRObjectKind”. Gets which
kind of object (for example,
box, cross-tab, field, etc.).
LeftLong. Gets or sets the upper
left position, in twips.
LineColorOLE_COLOR. Gets or sets the
line color.
LineStyle“CRLineStyle”. Gets or sets the
line style.
LineThicknessLong. Gets or sets the line
thickness, in twips.
NameString. Gets or sets the object
name.
Parent“Section Object”. Gets
reference to the parent object.
RightLong. Gets or sets the object
lower right position, in twips.
Read/
Write
Read/
Wri te
Read
only
Read/
Wri te
Read/
Wri te
Read/
Wri te
Read/
Wri te
Read/
Wri te
Read
only
Read/
Wri te
Restriction in event handler
Can be written only when
formatting idle.
None
Can be written only when
formatting idle or active.
Can be written only when
formatting idle.
Can be written only when
formatting idle.
Can be written only when
formatting idle.
Can be written only when
formatting idle.
None
Can be written only when
formatting idle.
SuppressBoolean. Gets or sets the object
visibility.
TopLong. Gets or sets the object
upper top position, in twips.
Read/
Wri te
Read/
Wri te
Can be written only when
formatting idle.
Can be written only when
formatting idle.
ConnectionProperty Object
The ConnectionProperty Object is a property bag that stores connection
information for the report. Information is dependent on the Crystal Decisions
database DLL used by the report and the database drivers that support the DLL.
The collection of ConnectionProperty objects can hold common properties defined
in our database DLLs, connection properties from the supporting drivers, or both.
For example a report based off an OLEDB (ADO) connection to Microsoft SQL
Server will contain properties supplied by the database DLL (crdb_ado.dll) such as
Crystal Reports Technical Reference Guide33
ConnectionProperty Object
Provider, Data Source, Initial Catalog, User ID, and Password, as well as the
properties supplied by the supporting drivers such as Local Identifier, Connect
Timeout and so on. The values for these properties can be set to connect to the
current data source for the report or to change the data source for the report.
For more information on the common connection properties see “Common
Connection Properties” on page 36.
ConnectionProperty Object Properties
Examples
How to connect to a Microsoft Access database
How to connect to a secured Microsoft Access database
How to connect to an ODBC data source
How to connect to an OLEDB data source
How to change the data source
How to list the connection properties and connect to a report
Table 12:
PropertyDescription
ChildProperties“ConnectionProperties Collection”. Gets the
child properties of this connection property in a
hierarchal property structure.
DescriptionString. Gets or sets the description of the
connection property.
LocalizedNameString. Gets or sets the localized name of the
connection property.
NameString. Gets or sets the name of the connection
property.
ValueVariant. Gets or Sets the value of the connection
property.
Note: Some Values are Write only. For example
the value for the Password connection property.
Read/
Write
Read
only
Read/
Wri te
Read/
Wri te
Read/
Wri te
Read/
Wri te
Restriction in
event handler
None
None
None
None
None
34Crystal Reports Technical Reference Guide
Common Connection Properties
The following table lists the connection properties defined in the Crystal Decisions
database DLLs. Use these properties when connecting to the desired data source.
Table 13:
2 Report Designer Component Object Model
Data source
ODBC (RDO)
crdb_odbc.dll
Connection
property
name
Connection
String
DatabaseString. The name of the
Database
Typ e
DSNString. The ODBC data sourec
FILEDSNString. Path to the File DSN.DSN, FILEDSN and
Connection property value
description
String. The complete
connection string containting
the driver information. This
can be obtained from content
of a File DSN.
database.
String. The type of file. For
example:
ODBC (RDO)
- or OLE DB (ADO)
name.
Remarks
DSN, FILEDSN and
Connection String are
mutually exclusive
This property can be
used together with the
DSN, FILEDSN, and
Connection String.
This is an optional
property.
DSN, FILEDSN and
Connection String are
mutually exclusive.
Connection String are
mutually exclusive
PasswordString. The password used to
connect to the data source.
Trus te d_ Co nn
ection
Crystal Reports Technical Reference Guide35
Boolean. Set to True if you
want the connection to use
NT Authentication.
This property can be
used together with the
DSN, FILEDSN, and
Connection String.
This property can be
used together with the
DSN, FILEDSN, and
Connection String.
ConnectionProperty Object
Table 13:
Data source
OLE DB (ADO)
crdb_ado.dll
Connection
property
name
User IDString. The user name
Data SourceString. The data source that
DatabaseString. The name of the
Database
Typ e
Integrated
Security
Connection property value
description
required to connect to the
data source.
the OLE DB provider is
connected to such as a file
path and database name or a
server name.
database.
String. The type of file. For
example:
ODBC (RDO)
- or OLE DB (ADO)
Boolean. Set to True if you
want the connection to use
NT Authentication.
Remarks
This property can be
used together with the
DSN, FILEDSN, and
Connection String.
This property can be
used together with the
Provider and Microsoft
Data Link File.
This property can be
used together with the
Provider and Microsoft
Data Link File.
This is an optional
property.
This property can be
used together with the
Provider and Microsoft
Data Link File.
Microsoft
Data Link File
PasswordString. The password used to
ProviderThe name of the OLEDB
36Crystal Reports Technical Reference Guide
String. The file path to the
Data Link.
connect to the data source.
provider. For example:
Microsoft.Jet.OLEDB.4.0
-orSQLOLEDB
Provider and Microsoft
Data Link File are
mutually exclusive.
This property can be
used together with the
Provider and Microsoft
Data Link File.
Provider and Microsoft
Data Link File are
mutually exclusive.
Table 13:
2 Report Designer Component Object Model
Data source
Access/Excel
(DAO)
crdb_dao.dll
Connection
property
name
User IDString. The user name
Database
Name
Database
Password
Database
Typ e
Session
Password
Connection property value
description
required to connect to the
data source.
String. The full file path to the
databse.
String. The password used to
connect to the data source.
String. The type of file. For
example:
ODBC (RDO)
- or OLE DB (ADO)
String. The password for a
system DSN.
Remarks
This property can be
used together with the
Provider and Microsoft
Data Link File.
This property is required
for changing the location
and name of the
database.
This property is only
required if the daabse
has database level
security.
This is an optional
property.
You must provide
System Database Path if
Session UserID and
Session Password are
provided.
Session
UserID
System
Database Path
Crystal Reports Technical Reference Guide37
String. The user name for a
system DSN.
String. You must provide
You must provide
System Database Path if
Session UserID and
Session Password are
provided.
System Database Path if
Session UserID and
Session Password are
provided.
ConnectionProperty Object
Table 13:
Data source
Oracle
crdb_oracle.dll
Native
connections to
local databases.
crdb_p2b*.dll
Connection
property
name
Database
Typ e
ServerString. The Service name.
PasswordString. The password used to
User IDString. The user name
Database PathString. The full file path to the
Connection property value
description
String. The type of file. For
example:
ODBC (RDO)
- or OLE DB (ADO)
connect to the data source.
required to connect to the
data source.
database.
Remarks
This is an optional
property.
These include Act!,
Btrieve, DB2, Dbase,
FoxPro, Paradox and so
on.
This property is required
for changing the location
and name of the
database.
Database
Typ e
PasswordString. The password used to
User IDString. The user name
38Crystal Reports Technical Reference Guide
String. The type of file. For
example:
ODBC (RDO)
- or OLE DB (ADO)
connect to the data source.
required to connect to the
data source.
This is an optional
property.
Table 13:
2 Report Designer Component Object Model
Data source
Native
connections to
server data
sources.
crdb_p2s*.dll
Field Definitions
Only
crdb_fielddef.dll
Connection
property
name
DatabaseString. The database name.
Database
Typ e
ServerString. The server name.
PasswordString. The password used to
User IDString. The user name
Connection property value
description
String. The type of file. For
example:
ODBC (RDO)
- or OLE DB (ADO)
connect to the data source.
required to connect to the
data source.
Remarks
These include Informix,
DB2 Server, Lotus
Domino, and so on.
This is an optional
property.
Database
Typ e
Field
Definition
File
File Systam Data
crdb_FileSystem.d
ll
Crystal Reports Technical Reference Guide39
String. The type of file. For
example:
ODBC (RDO)
- or OLE DB (ADO)
String. The full file and path
to the Field defintion file
(*.ttx).
This is an optional
property.
ConnectionProperties Collection
Table 13:
Data source
Connection
property
name
Database
Typ e
File MaskString. A mask to filter the
Include
Empty
Directories
Max Number
of
Subdirectory
Levels
Starting
Directory
Connection property value
description
String. The type of file. For
example:
ODBC (RDO)
- or OLE DB (ADO)
types of files returned. For
example:
*.exe
Boolean. Set to True to
include empty directories.
Integer. The number of
subdirectory levels to include.
String. The path to the
starting directory.
Remarks
This is an optional
property.
Set this value to -1 to
include all
subdirectories.
ConnectionProperties Collection
The ConnectionProperties Collection is a collection of “ConnectionProperty
Object” in a report. Each object in the collection is a property bag that contains
information on a connection property. Use the Item property to access a specific
ConnectionProperty Object in the Collection.
For more information on the common connection properties see “Common
Connection Properties” on page 36.
40Crystal Reports Technical Reference Guide
2 Report Designer Component Object Model
ConnectionProperties Collection Properties
Examples
How to connect to a Microsoft Access database
How to connect to a secured Microsoft Access database
How to connect to an ODBC data source
How to connect to an OLEDB data source
How to change the data source
How to list the connection properties and connect to a report
Table 14:
PropertyDefinition
CountLong. Gets the number of objects in the collection.Read
Item
(indexAs
Long)
NameIdsVariant. Returns an array containing the name of each
“ConnectionProperty Object”. Gets an item from the
Collection specified by name.
connection property in the collection.
Read/
Write
only
Read
only
Read
only
ConnectionProperties Collection Methods
The following methods are discussed in this section:
• “Add Method (ConnectionProperties Collection)” on page 42
• “Delete Method (ConnectionProperties Collection)” on page 43
• “DeleteAll Method (ConnectionProperties Collection)” on page 44
Add Method (ConnectionProperties Collection)
Use the Add method to add a ConnectionProperty Object to the Collection as a
name value pair.
Restriction in
event handler
None
None
None
Crystal Reports Technical Reference Guide41
ConnectionProperties Collection
Examples
How to change the data source
Syntax
Function Add (Name As String, Value)
ParameterDescription
NameSpecifies the name of the connection property that you want to
ValueSpecifies the value of the connection property.
Remarks
Use this method if alternate connection properties are required to establish a
connection to a new data source. For example changing the report’s database
driver through the DLLName property in the “DatabaseTable Object”, or
connecting to a report created off an OLEDB (ADO) data source to a different
provider (Microsoft.Jet.OLEDB.4.0 to SQLOLEDB). Use the “Delete Method
(ConnectionProperties Collection)” or the “DeleteAll Method
(ConnectionProperties Collection)”to remove any connection properties.
Table 15:
add to the Collection.
Delete Method (ConnectionProperties Collection)
Use the Delete method to remove a ConnectionProperty Object from the
Collection.
Examples
How to change the data source
Syntax
Sub Delete (index)
42Crystal Reports Technical Reference Guide
2 Report Designer Component Object Model
Parameter
Table 16:
ParameterDescription
indexSpecifies the index number of the Object that you want to
remove from the Collection.
Remarks
Use this method to remove any connection properties that are no longer required
when connecting to a new data source. For example changing the report’s database
driver through the DLLName property in the “DatabaseTable Object”, or
connecting a report created off an OLEDB (ADO) data source to a different
provider (Microsoft.Jet.OLEDB.4.0 to SQLOLEDB). Use the “Add Method
(ConnectionProperties Collection)” to add any new connection properties.
Use the Delete method to remove all ConnectionProperty Objects from the
Collection.
Examples
How to change the data source
Syntax
Sub DeleteAll ()
Remarks
Use this method to remove all existing connection properties when connecting to
a new data source. For example changing the report’s database driver through the
DLLName property in the “DatabaseTable Object”, or connecting a report created
off an OLEDB (ADO) data source to a different provider (Microsoft.Jet.OLEDB.4.0
to SQLOLEDB). Use the “Add Method (ConnectionProperties Collection)” to add
any new connection properties.
CrossTabGroup Object
The CrossTabGroup Object contains information related to CrossTabGroups in a
report.
Crystal Reports Technical Reference Guide43
CrossTabGroup Object
CrossTabGroup Properties
Examples
How to add, delete and format groups in a crosstab
Table 17:
PropertyDescriptionRead/WriteRestriction in event handler
BackColorOLE_COLOR. Gets or sets the
Condition“CRGroupCondition”. Gets or
EnableSuppress
Label
EnableSuppress
Subtotal
FieldA field definition object. Gets
Parent“CrossTabObject Object”. Gets
SortDirection“CRSortDirection”. Gets or
crosstab group background
color.
sets the crosstab group
condition.
Boolean. Gets or sets the
crosstab group enable
suppress label option.
Boolean. Gets or sets the
crosstab group enable
suppress subtotal option.
or sets the crosstab group’s
field. See Remarks.
reference to the crosstab group
parent object.
sets the crosstab group sort
direction.
Remarks
After getting the field definition object from the Field property, you can use the
Kind property to determine what type of field definition object it is. All field
definition objects have the Kind property.
Read/WriteIdle
Read/WriteIdle
Read/WriteIdle
Read/WriteIdle
Read/WriteIdle
Read onlyNone
Read/WriteIdle
44Crystal Reports Technical Reference Guide
2 Report Designer Component Object Model
CrossTabGroups Collection
The CrossTabGroups Collection contains CrossTabGroup Objects associated with
a report.
CrossTabGroups Collection Properties
Table 18:
PropertyDescriptionRead/WriteRestriction in event handler
CountLong. Gets the CrossTabGroup
count.
Item (index As
Long)
Parent“CrossTabObject Object”. Gets
“CrossTabGroup Object”. Gets
an item from the Collection.
reference to the parent object.
Read onlyNone
Read onlyNone
Read onlyNone
CrossTabGroups Collection Methods
The following methods are discussed in this section:
• “Add Method (CrossTabGroups Collection)” on page 46
• “Delete Method (CrossTabGroups Collection)” on page 47
Add Method (CrossTabGroups Collection)
Examples
How to add, delete and format groups in a crosstab
Use the Add method to add a field as a CrossTabGroup to the CrossTabGroups
Collection.
Syntax
Function Add (Field) As CrossTabGroup
Crystal Reports Technical Reference Guide45
CrossTabObject Object
Parameter
Returns
Returns a CrossTabGroup Object member of the Collection.
Delete Method (CrossTabGroups Collection)
Examples
How to add, delete and format groups in a crosstab
Use the Delete method to remove a CrossTabGroup Object from the Collection.
Syntax
Sub Delete (index As Long)
Table 19:
ParameterDescription
FieldSpecifies the field that you want to add as a CrossTabGroup to
the Collection.
Parameter
Table 20:
ParameterDescription
indexSpecifies the index of the CrossTabGroup Object that you want
to delete from the Collection.
CrossTabObject Object
The CrossTabObject Object allows you to get and set information for cross-tab
objects in a report.
46Crystal Reports Technical Reference Guide
2 Report Designer Component Object Model
CrossTabObject Object Properties
Table 21:
PropertyDescriptionRead/WriteRestriction in event handler
BackColorOLE_COLOR. Gets or sets
the object background color.
BorderColorOLE_COLOR. Gets or sets
the object border color.
BottomLineStyle“CRLineStyle”. Gets or sets
the bottom line style.
CloseAtPageBreakBoolean. Gets or sets the
close border on page break
option.
ConditionFormulaString. Gets or sets the
condition formula. The
condition formula can be
based on recurring records or
on summary fields, but it
cannot be based on printtime fields, such as running
totals or print-time formulas.
Condition formulas cannot
have shared variables.
ColumnGrandTota
lColor
OLE_COLOR. Gets or sets
the column grand total color.
ColumnGroups“Remarks”. Gets the column
groups Collection.
Read/
Wri te
Read/
Wri te
Read/
Wri te
Read/
Wri te
Read/
Wri te
Read/
Can be written only when
formatting idle or active.
Can be written only when
formatting idle or active.
Can be written only when
formatting idle or active.
Can be written only when
formatting idle or active.
Can be written only when
formatting idle.
Idle
Wri te
Read onlyNone
CssClassString. Gets or sets the
cascading style sheet Class.
EnableKeepColum
nsTogether
Boolean. Gets or sets the
enable keep columns
Read/
Wri te
Read/
Wri te
Can be written only when
formatting idle.
Idle
together option.
EnableRepeatRow
Labels
Boolean. Gets or sets the
enable repeat row labels
Read/
Wri te
Idle
option.
Crystal Reports Technical Reference Guide47
CrossTabObject Object
Table 21:
PropertyDescriptionRead/WriteRestriction in event handler
EnableShowCellM
argins
EnableShowGridBoolean. Gets or sets the
EnableSuppressCo
lumnGrandTotals
EnableSuppressE
mptyColumns
EnableSuppressE
mptyRows
EnableSuppressRo
wGrandTotals
HasDropShadowBoolean. Gets or sets the
HeightLong. Gets the object height,
KeepTogetherBoolean. Gets or sets the
Boolean. Gets or sets the
enable show cell margins
option.
enable show grid option.
Boolean. Gets or sets the
enable suppress column
grand totals option.
Boolean. Gets or sets the
enable suppress empty
columns option.
Boolean. Gets or sets the
enable suppress empty rows
option.
Boolean. Gets or sets the
enable suppress row grand
totals option.
border drop shadow option.
in twips.
keep object together option.
Read/
Wri te
Read/
Wri te
Read/
Wri te
Read/
Wri te
Read/
Wri te
Read/
Wri te
Read/
Wri te
Read onlyCan be written only when
Read/
Wri te
Idle
Idle
Idle
Idle
Idle
Idle
Can be written only when
formatting idle or active.
formatting idle or active.
Can be written only when
formatting idle or active.
Kind“CRObjectKind”. Gets which
kind of object (for example,
box, cross-tab, field, etc.).
LeftLong. Gets or sets the upper
left position, in twips.
LeftLineStyle“CRLineStyle”. Gets or sets
the left line style.
NameString. Gets or sets the object
name.
48Crystal Reports Technical Reference Guide
Read onlyNone
Read/
Wri te
Read/
Wri te
Read/
Wri te
Can be written only when
formatting idle or active.
Can be written only when
formatting idle or active.
Can be written only when
formatting idle.
2 Report Designer Component Object Model
Table 21:
PropertyDescriptionRead/WriteRestriction in event handler
Parent“Section Object”. Gets
reference to the parent object.
RightLineStyle“CRLineStyle”. Gets or sets
RowGrandTotalCo
lor
RowGroups“Remarks”. Gets the row
SummaryFields“ObjectSummaryFieldDefini
SpecifiedGroupsGets or sets the specified
SuppressBoolean. Gets or sets the
TopLong. Gets or sets the object
TopLineStyle“CRLineStyle”. Gets or sets
WidthLong. Gets the object width,
the right line style.
OLE_COLOR. Gets or sets
the row grand total color.
groups Collection.
tions Collection”. Gets the
summary fields.
groups from a row or column
in the crosstab.
object visibility option.
upper top position, in twips.
top line style.
in twips.
Read onlyNone
Read/
Wri te
Read/
Wri te
Read OnlyNone
Read OnlyNone
Read/
Wri te
Read/
Wri te
Read/
Wri te
Read/
Wri te
Read OnlyCan be written only when
Can be written only when
formatting idle or active.
Idle
Can be written only when
formatting idle
Can be written only when
formatting idle or active.
Can be written only when
formatting idle or active.
Can be written only when
formatting idle or active.
formatting idle or active.
Database Object
The Database Object provides properties to get information about the database
accessed by a report. See “Overview of the Report Designer Object Model” on
page 14.
Crystal Reports Technical Reference Guide49
Database Object
Database Object Properties
Table 22:
PropertyDescription
Links“TableLinks Collection”. Gets database
link collection.
Parent “Report Object”. Gets reference to the
parent object.
Ta bl es“DatabaseTables Collection”. Gets the
DatabaseTables Collection which
specifies the database objects used in the
report (for example, an Access report may
contain a query or a SQL Server report
may be based on a stored procedure - if
so, they will be returned as part of this
collection along with the database table
used in the report).
Database Object Methods
The following methods are discussed in this section:
• “AddADOCommand Method (Database Object)” on page 51
• “AddOLEDBSource Method (Database Object)” on page 52
• “LogOffServer Method (Database Object)” on page 53
• “LogOnServer Method (Database Object)” on page 54
• “LogOnServerEx Method (Application Object)” on page 21
• “SetDataSource Method (Database Object)” on page 56
• “Verify Method (Database Object)” on page 57
Read/
Write
Read onlyNone
Read onlyNone
Read onlyNone
Restriction in
event handler
AddADOCommand Method (Database Object)
Use the AddADOCommand method to add a database table to your report
through an ADO connection and command.
Syntax
Sub AddADOCommand (pConnection, pCommand)
50Crystal Reports Technical Reference Guide
2 Report Designer Component Object Model
Parameters
Table 23:
ParameterDescription
pConnectionSpecifies the ADO connection that you want to use.
pCommandSpecifies the ADO command that you want to use.
AddOLEDBSource Method (Database Object)
Use the AddOLEDBSource method to add a database table to your report through
an OLE DB provider.
Syntax
Sub AddOLEDBSource (pConnectionString As String, pTableName As String)
Parameters
Table 24:
ParameterDescription
pConnectionStringSpecifies the connection string for the OLE DB provider.
pTableNameSpecifies the OLE DB database table that you want to
add to your report.
Remarks
Some databases such as Oracle are case sensitive and require that proper case be
applied to the database names and table names in the connection string.
'Instantiate the report object.
Set m_Report = New CrystalReport1
' Convert the database driver to ODBC.
m_Report.Database.ConvertDatabaseDriver "p2sodbc.dll", True
' Set the logon information for the ODBC data source.
' If the logon information is not set, an error will be produced when the
' report is previewed or exported.
' Verify the database.
' If the database is not verified before exporting, an error will be
produced.
' If the database is not verified before previewing the report, the user may
be
' prompted when the report is refreshed in the Crystal Report Viewer.
m_Report.Database.Verify
LogOffServer Method (Database Object)
The LogOffServer method logs off an SQL server, ODBC or other data source. Use
this method when you have logged on to the data source using LogOnServer. This
method can be invoked only in formatting Idle mode.
Syntax
Sub LogOffServer (pDllName As String, pServerName As String,
[pDatabaseName], [pUserID], [pPassword])
Parameters
Table 25:
ParameterDescription
pDllNameSpecifies the name of the DLL for the server or password protected non-
pServerNameSpecifies the log on name for the server used to create the report. For ODBC,
[pDatabaseName]Specifies the name for the database used to create the report. See Remarks
[pUserID]Specifies the User ID number necessary to log on to the server. See Remarks
[pPassword]Specifies the password necessary to log on to the server.
52Crystal Reports Technical Reference Guide
SQL table you want to log on to, for example "P2SODBC.DLL". Note that
the dllName must be enclosed in quotes. DLL names have the following
naming convention: P2B*.DLL for standard (non-SQL) databases, P2S*.DLL
for SQL/ODBC databases.
use the data source name. This value is case-sensitive. See Remarks below.
below.
below.
2 Report Designer Component Object Model
Remarks
• When you pass an empty string ("") for pServerName, pDatabaseName, or
pUserID, the program uses the value that's already set in the report. If you
want to override a value that's already set in the report, use a non-empty string
(for example, "Server A").
• If you try to log off a server that is still in use (that is, there is an object variable
still in focus that holds reference to a report that requires being logged on to
the server to access data) you will be unable to log off. This will apply to every
object that comes from the “Report Object”, as they all hold reference to the
report through their respective Report properties.
• If you assign the Report object to the ReportSource property of the “CRViewer
Object (CRVIEWERLib)”, in the Crystal Reports Report Viewer, enabling the
report to be displayed through the Report Viewer, you cannot call
LogOffServer for the report until you assign a new report to the Report Viewer
or close the CRViewer object.
LogOnServer Method (Database Object)
The LogOnServer method logs on to an SQL server, ODBC or other data source.
Once logged on using this method, you will remain logged on until you call
LogOffServer or until the Application Object is destroyed and craxdrt.dll is
unloaded. This method can be invoked only in formatting Idle mode.
Syntax
Sub LogOnServer (pDllName As String, pServerName As String,
[pDatabaseName], [pUserID], [pPassword])
Parameters
Table 26:
ParameterDescription
pDllNameSpecifies the name of the DLL for the server or password protected non-
pServerNameSpecifies the log on name for the server used to create the report. For
Crystal Reports Technical Reference Guide53
SQL table you want to log on to, for example "P2SODBC.DLL". Note that
the dllName must be enclosed in quotes. DLL names have the following
naming convention: P2B*.DLL for standard (non-SQL) databases,
P2S*.DLL for SQL/ODBC databases.
ODBC, use the data source name. This value is case-sensitive. See Remarks
below.
Database Object
Table 26:
ParameterDescription
[pDatabaseName]Specifies the name for the database used to create the report. See Remarks
below.
[pUserID]Specifies the User ID number necessary to log on to the server. See Remarks
[pPassword]Specifies the password necessary to log on to the server.
below.
Remarks
When you pass an empty string ("") for this parameter, the program uses the value
that's already set in the report. If you want to override a value that's already set in
the report, use a non-empty string (for example, "Server A").
LogOnServerEx Method (Database Object)
The LogOnServerEx method logs on to an SQL server, ODBC or other data source.
Using this method, you can pass ServerType and ConnectionString info. Once
logged on using this method, you will remain logged on until you call
LogOffServer or until the Application Object is destroyed and craxdrt.dll is
unloaded. This method can be invoked only in formatting Idle mode.
Syntax
Sub LogOnServerEx (pDllName As String, pServerName As String,
pDllNameSpecifies the name of the DLL for the server or password protected non-
SQL table you want to log on to, for example "P2SODBC.DLL". Note that
the dllName must be enclosed in quotes. DLL names have the following
naming convention: P2B*.DLL for standard (non-SQL) databases,
P2S*.DLL for SQL/ODBC databases.
54Crystal Reports Technical Reference Guide
2 Report Designer Component Object Model
Table 27:
ParameterDescription
pServerNameSpecifies the log on name for the server used to create the report. For
ODBC, use the data source name. This value is case-sensitive. See
Remarks below.
[pDatabaseName]Specifies the name for the database used to create the report. See
Remarks below.
[pUserID]Specifies the User ID number necessary to log on to the server. See
[pPassword]Specifies the password necessary to log on to the server.
[pServerType]Specifies the database Server Type.
[pConnectionString]Specifies the connection string.
Remarks below.
Remarks
When you pass an empty string ("") for this parameter, the program uses the value
that's already set in the report. If you want to override a value that's already set in
the report, use a non-empty string (for example, "Server A").
SetDataSource Method (Database Object)
The SetDataSource method is used to provide information about a data source to
the database driver associated with this Database object at runtime. For instance,
if a report has been designed using the Crystal Active Data Driver this method can
be used to provide an active data source for the report, such as a DAO, ADO, or
RDO Recordset or a CDO Rowset. In this case, the object passed to the second
parameter of this method replaces, at runtime, the field definition file used to
create the report. This method can be invoked only in formatting Idle mode. When
using a secure connection such as SQL Server, some additional code is required
(see Remarks below).
Syntax
Sub SetDataSource (data, [dataTag], [tableNumber])
Crystal Reports Technical Reference Guide55
Database Object
Parameters
Table 28:
ParameterDescription
dataVariant data passed to the database driver. For example, with Active data,
this must be a Recordset object if you are using DAO, ADO, or the Visual
Basic data control. This must be a Rowset object if you are using CDO.
[dataTag]A value indicating the type of data being passed to the DatabaseTable object
in the Data parameter. Currently, the only possible value is 3. This value must
be used for all Active data sources including DAO, ADO, RDO, CDO, and the
Visual Basic data control.
[tableNumber]Specifies the index number of the table to be set. Default value = 1.
Remarks
• When the data source uses a secure connection, such as SQL Server, additional
information must be passed in the "form load" event before the call to view the
report. For example,
• SetDataSource method is used to set a datasource at runtime. If the report is
initially created and then saved, and then later run using either the RDC or
CRW, the runtime datasource (DAO, ADO, or RDO Recordset) cannot be
recreated. The user will not be able to run or preview the report.
Verify Method (Database Object)
The Verify method verifies that the location of the database is still valid and checks
to see if any changes have been made to table design, etc. If there are any changes
to the database, the Verify method will update the report automatically to reflect
these changes. See Remarks below. This method can be invoked only in formatting
Idle mode.
Syntax
Sub Verify ()
Remarks
Prior to calling Verify, you can use the “CheckDifferences Method (DatabaseTable
Object)” to determine what kind of differences, if any, exist between the report
table and the physical table. pDifferences parameter of CheckDifferences method
56Crystal Reports Technical Reference Guide
2 Report Designer Component Object Model
will pass back one or more bitwise (XOR’d) “CRTableDifferences” enums
indicating the information that you want to retrieve.
DatabaseFieldDefinition Object
The DatabaseFieldDefinition Object represents a database field used in the report.
This object provides properties for getting information on database fields in the
report.
DatabaseFieldDefinition Object Properties
Table 29:
PropertyDefinition
DatabaseFieldDispl
ayName
DatabaseFieldNameString. Gets the name of the field in
Kind“CRFieldKind”. Gets which kind of
NameString. Gets the unique Crystal
NextValueVariant. Gets the field next value.Read
NumberOfBytesInteger. Gets the number of bytes
Parent“Report Object”. Gets reference to the
String. Gets the display name for the
field in the database.
the database (for example, Product
ID).
field (for example, database,
summary, formula, etc.).
formula form name of the field
within the report as {table.FIELD}
(for example, {product.PRODUCT
ID}).
required to store the field data in
memory.
parent object.
Read/
Write
Read
Only
Read
only
Read
only
Read
only
only
Read
only
Read
only
Restriction in event
handler
None
None
None
None
Ca n be read onl y wh en
top-level Report object
is formatting active.
None
None
Crystal Reports Technical Reference Guide57
DatabaseFieldDefinitions Collection
Table 29:
PropertyDefinition
PreviousValueVariant. Gets the field previous value.Read
TableAliasNameString. Gets the alias for the table
containing the field.
ValueVariant. Gets the field current value.Read
Va lu eTy pe“CRFieldValueType”. Gets which
type of value is found in the field.
Read/
Write
only
Read
only
only
Read
only
DatabaseFieldDefinitions Collection
The DatabaseFieldDefinitions Collection is a collection of database field definition
objects. One object exists in the collection for every database field accessed by the
report. Access a specific “DatabaseFieldDefinition Object” in the collection using
the Item property.
DatabaseFieldDefinitions Collection Properties
Restriction in event
handler
Ca n be read onl y wh en
top-level Report object
is formatting active.
None
Ca n be read onl y wh en
top-level Report object
is formatting active.
None
Table 30:
PropertyDescription
CountLong. Gets the number of “DatabaseFieldDefinition
Item (index
As Long)
Parent“DatabaseTable Object”. Reference to the parent
58Crystal Reports Technical Reference Guide
Object”, in the collection.
“DatabaseFieldDefinition Object”. Item has an index
parameter that is a numeric, 1-based index for the
object that you want to retrieve (for example, Item (1)
for the first database field in the collection). The items
in the collection are indexed in the order they appear
in the database table.
object.
Read/
Write
Read
only
Read
only
Read
only
Restriction in
event handler
None
None
None
2 Report Designer Component Object Model
Remarks
Instead of using the Item property as shown, you can reference a database directly
(for example, DatabaseFieldDefinitions(1)).
DatabaseFieldDefinitions Collection Methods
The following method is discussed in this section:
• “GetItemByName Method (DatabaseFieldDefinitions Collection)” on page 60
Use the GetItemByName method to retrieve a DatabaseFieldDefinition object by
name.
Syntax
Sub GetItemByName(name As String, databaseFieldDefinition)
Parameters
Table 31:
ParameterDescription
nameThe item’s unique name.
databaseFieldDefinition“DatabaseFieldDefinition Object”. An object to
hold the retrieved item.
DatabaseTable Object
The DatabaseTable Object refers to a database table accessed by the report.
Crystal Reports Technical Reference Guide59
DatabaseTable Object
DatabaseTable Object Properties
Examples
How to connect to a Microsoft Access database
How to connect to a secured Microsoft Access database
How to connect to an ODBC data source
How to connect to an OLEDB data source
How to change the data source
Table 32:
PropertyDescription
ConnectBufferSt
ring
ConnectionProp
erties
DatabaseType“CRDatabaseType”. Gets the database
DescriptiveNameString. Gets the table descriptive name.Read
DllNameString. Gets the table driver DLL name.Read
Fields“DatabaseFieldDefinitions Collection
LocationString. Gets or sets the location of the
NameString. Gets or sets the alias name for the
Parent“Database Object”. Reference to the
String. Gets the table connect buffer
string.
“ConnectionProperties Collection”. Gets
the collection of connection properties
from the table.
table type
Properties”. Gets the collection of
database fields in the table.
database table.
database table used in the report.
parent object.
Read/
Write
Read
only
Read
only
Read
only
only
only
Read
only
Read/
Wri te
Read/
Wri te
Read
only
Restriction in event
handler
None
None.
None
None
None
None
Can be written only
when formatting idle.
Can be written only
when formatting idle.
None
DatabaseTable Object Methods
The following methods are discussed in this section:
• “CheckDifferences Method (DatabaseTable Object)” on page 62
60Crystal Reports Technical Reference Guide
2 Report Designer Component Object Model
• “SetDataSource Method (DatabaseTable Object)” on page 62
• “SetTableLocation Method (DatabaseTable Object)” on page 63
• “TestConnectivity Method (DatabaseTable Object)” on page 64
CheckDifferences Method (DatabaseTable Object)
Use the CheckDifferences method to determine what kind(s) of differences were
found between the report table and the physical table.
Syntax
Sub CheckDifferences (pDifferences As Long, [reserved])
Parameters
Table 33:
ParameterDescription
pDifferences“CRTableDifferences”. Bitwise constants specify the table
[reserved]Reserved. Do not use.
difference(s) (XOR’d), if any.
SetDataSource Method (DatabaseTable Object)
The SetDataSource method is used to provide information about a data source to
the database driver associated with this DatabaseTable object at runtime. For
instance, if a report has been designed using the Crystal Active Data Driver this
method can be used to provide an active data source for the report, such as a DAO,
ADO, or RDO Recordset or a CDO Rowset. In this case, the object passed to the
second parameter of this method replaces, at runtime, the field definition file used
to create the report. This method can be invoked only in formatting Idle mode.
When using a secure connection such as SQL Server, some additional code is
required (see Remarks below).
Syntax
Sub SetDataSource (data, [dataTag])
Crystal Reports Technical Reference Guide61
DatabaseTable Object
Parameters
Table 34:
ParameterDescription
dataVariant data passed to the database driver. For example, with
Active data, this must be a Recordset object if you are using
DAO, ADO, or the Visual Basic data control. This must be a
Rowset object if you are using CDO.
[dataTag]A value indicating the type of data being passed to the
DatabaseTable object in the Data parameter. Currently, the
only possible value is 3. This value must be used for all
Active data sources including DAO, ADO, RDO, CDO, and
the Visual Basic data control.
Remarks
• When the data source uses a secure connection, such as SQL Server, additional
information must be passed in the "form load" event before the call to view the
report. For example,
• SetDataSource method is used to set a datasource at runtime. If the report is
initially created and then saved, and then later run using either the RDC or
CRW, the runtime datasource (DAO, ADO, or RDO Recordset) cannot be
recreated. The user will not be able to run or preview the report.
SetTableLocation Method (DatabaseTable Object)
The SetTableLocation method is used to set the DatabaseTable location,
sublocation, and connect buffer string.
Examples
How to connect to a Microsoft Access database
How to connect to a secured Microsoft Access database
Syntax
Sub SetTableLocation (pLocation As String, pSubLocation As String,
pConnectBufferSting As String)
62Crystal Reports Technical Reference Guide
2 Report Designer Component Object Model
Parameters
Table 35:
ParameterDescription
pLocationSpecifies the location of the database table (file path and name.ext).
pSubLocationSpecifies the sublocation of the database table.
pConnectBufferStingSpecifies the connection buffer string.
The TestConnectivity method tests to see if the database can be logged on to with
the current information and if the database table can be accessed by the report.
Syntax
Function TestConnectivity () As Boolean
Returns
• TRUE if the database session, log on, and location information is all correct.
• FALSE if the connection fails or an error occurs.
DatabaseTables Collection
The DatabaseTables Collection is a collection of DatabaseTable objects. A
DatabaseTable object exists for every database object (for example, table, query,
stored procedure, etc.) accessed by the report. Access a specific DatabaseTable
Object in the collection using the Item property.
Crystal Reports Technical Reference Guide63
DatabaseTables Collection
DatabaseTables Collection Properties
Table 36:
PropertyDescription
CountLong. Gets the number of database objects in the
Item
(indexAs
Long)
Parent“Database Object”. Reference to the parent object.Read
collection.
“DatabaseTable Object”. Item has an index
parameter that is a numeric, 1-based index (for
example, Item (1)). The items in the collection are
indexed in the order in which they were added to the
report.
Read/
Write
Read
only
Read
only
only
Remarks
Instead of using the Item property as shown, you can reference a table directly (for
example, DatabaseTable(1)).
DatabaseTables Collection Methods
The following methods are discussed in this section:
• “Add Method (DatabaseTables Collection)” on page 65
• “AddStoredProcedure Method (DatabaseTables Collection)” on page 66
• “Delete Method (DatabaseTables Collection)” on page 68
Restriction in
event handler
None
None
None
Add Method (DatabaseTables Collection)
Use the Add method to add a database table to the report.
Syntax
Sub Add (pLocation As String, [pSubLocation], [pConnectInfo],
pLocationSpecifies the location of the database table that you want
to add to the report.
[pSubLocation]Specifies the sublocation of the database table that you
want to add to the report.
[pConnectInfo]Specifies the connection string.
[tableType]Specifies the type of database table that you want to add
to the report.
[pDllName]Specifies the DLL name for the database containing the
[pServerName]Specifies the database Server Name.
[pServerType]Specifies the database Server Type.
[pDatabaseName]Specifies the database (file path and name.ext) containing
[pUserID]Specifies the User’s ID.
[pPassword]Specifies the User’s Password.
table that you want to add.
the table that you want to add.
Remarks
• DatabaseTables.Add method is very generic and can be used to add tables to a
report from all kinds of data sources (for example, PC Table, SQL Server,
ODBC, OLE DB provider, ADO, RDO, DAO Recordset).
• For example:
object.Add "xtreme.mdb", "Customer"
• You may use Add() to add a stored procedure to a report. No inital values are
passed to the procedure’s parameters so you need to set the values later using
other API functions. To pass parameter values at the time of adding the stored
procedure, use the “AddStoredProcedure Method (DatabaseTables
Collection)” instead.
AddStoredProcedure Method (DatabaseTables
Crystal Reports Technical Reference Guide65
DatabaseTables Collection
Collection)
Use the AddStoredProcedure method to add a stored procedure and its initial
parameter values to the report.
pLocationSpecifies the location of the database table that you want to add to the
report.
[pSubLocation]Specifies the sublocation of the database table that you want to add to the
[pConnectInfo]Specifies the connection string.
[tableType]Specifies the type of database table that you want to add to the report.
[pDllName]Specifies the DLL name for the database containing the table that you want
[pServerName]Specifies the database Server Name.
[pServerType]Specifies the database Server Type.
[pDatabaseName]Specifies the database (file path and name.ext) containing the table that
[pUserID]Specifies the User’s ID.
[pPassword]Specifies the User’s Password.
[ParamValuesInfos]ParameterValueInfos Collection. Specifies the initial values for the stored
report.
to add.
you want to add.
procedure’s parameters.
Remarks
AddStoredProcedure() has one additional parameter that Add() does not have:
ParamValuesInfos. This parameter allows the initial values for the stored
procedure’s parameters to be passed at the same time as the procedure is added to
66Crystal Reports Technical Reference Guide
2 Report Designer Component Object Model
the report. If you do not want to pass initial parameter values, use “Add Method
(DatabaseTables Collection)” instead.
Delete Method (DatabaseTables Collection)
Use the Delete method to remove a database table from the Collection.
Syntax
Sub Delete (index As Long)
Parameter
Table 39:
ParameterDescription
indexSpecifies the 1-based index number in the Collection of the
database table that you want to delete.
ExportOptions Object
The ExportOptions object provides properties and methods for retrieving
information and setting options for exporting your report (that is, export format,
destination, etc.). An ExportOptions Object is obtained from the ExportOptions
property of the “Report Object”.
ExportOptions Object Properties
Ta b le 40 :
PropertyDescription
ApplicationFileNameString. Gets or sets the destination
application file name.
CharFieldDelimiterString. Gets or sets the character used to
separate fields in character separated text
formats. This character delimits every
field in the file.
Read/
Write
Read
/
Wri te
Read
/
Wri te
Restriction in event
handler
Set before exporting
report to an
application
destination.
None
Crystal Reports Technical Reference Guide67
ExportOptions Object
Ta b le 40 :
PropertyDescription
CharStringDelimiterString. Gets or sets the character used to
separate strings in character separated
text formats. This character delimits only
string fields (numeric, date fields, etc.,
have no delimiter).
DestinationDLLNameString. Gets the Internal Name property
of the DLL used to export the report to a
certain destination. The destination is set
in the DestinationType property.
DestinationType“CRExportDestinationType”. Gets or sets
the export destination type.
DiskFileNameString. Gets or sets the file name if the
report is exported to a disk.
When exporting to HTML use
HTMLFileName. When exporting to XML
use XMLFileName.
ExcelAreaGroupN
umber
ExcelAreaType“CRAreaKind”. Gets or sets the base area
Integer. Gets or sets the base area group
number if the area type is group area
when exporting to Excel.
type if not using constant column width
when exporting to Excel.
Read/
Write
Read
/
Wri te
Read
only
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Restriction in event
handler
None
None
None
None
None
None
ExcelConstantColu
mnWidth
ExcelConvertDate
To St ri ng
ExcelExportAllPagesBoolean. Gets or sets export to Excel with
ExcelFirstPageNu
mber
68Crystal Reports Technical Reference Guide
Double. Gets or sets the column width
when exporting to Excel.
Boolean. Gets or sets export to Excel has
converting date values to strings option.
all pages.
Long. Gets or sets export to Excel for first
page number.
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
None
None
None
None
Ta b le 40 :
2 Report Designer Component Object Model
PropertyDescription
ExcelLastPageNu
mber
ExcelPageBreaksBoolean. Gets or sets export to Excel has
ExcelTabHasColu
mnHeadings
ExcelUseConstant
ColumnWidth
ExcelUseTabularFo
rmat
ExcelUseWorkshee
tFunctions
ExchangeDestinati
onType
Long. Gets or sets export to Excel for last
page number.
page break option.
Boolean. Gets or sets exporting to Excel
has column headings option.
Boolean. Gets or sets export to Excel to
use constant column width.
Boolean. Gets or sets exporting to Excel to
use tabular format.
Boolean. Gets or sets export to Excel to
use worksheet functions to represent
subtotal fields in the report.
“CRExchangeDestinationType”. Gets or
sets the Exchange destination type for
reports exported to Exchange folders.
Read/
Write
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Restriction in event
handler
None
None
None
None
None
None
None
ExchangeFolderPathString. Gets or sets the path of the
Exchange folder for reports exported to
Exchange (for example,
“MyFolders@Inbox”).
ExchangeProfileString. Gets or sets a user profile for
accessing an Exchange folder for reports
exported to Exchange.
ExchangePathHas
ColumnHeadings
Crystal Reports Technical Reference Guide69
Boolean. Gets or sets the column heading
option when exporting to Exchange.
Read
/
Wri te
only
Read
/
Wri te
Read
/
Wri te
None
None
None
None
ExportOptions Object
Ta b le 40 :
PropertyDescription
FormatDLLNameString. Gets the Internal Name property
of the DLL used to export the report to a
certain format type. The export format
type is set in the FormatType property.
FormatType“CRExportFormatType”. Gets or sets the
HTMLEnableSeper
atedPages
HTMLFileNameString. Gets or sets the HTML file name
HTMLHasPageNa
vigator
LotusDominoCom
ments
LotusDominoData
baseName
format type for the exported report (for
example, text, Excel, etc.).
Boolean. Gets or sets the option to create
seperated pages when exporting to
HTML format.
for reports exported to HTML format.
Boolean. Gets or sets the option to display
a page navigator on each page of a report
exported to HTML format.
String. Gets or sets the destination Lotus
Domino comments.
String. Gets or sets the destination Lotus
Domino database name.
Read/
Write
Read
only
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Restriction in event
handler
None
None
None
None
None
None
None
LotusNotesFormN
ame
MailBccListString. Gets or sets a Blind Carbon Copy
MailCcListString. Gets or sets a Carbon Copy (CC)
MailMessageString. Gets or sets the e-mail message
70Crystal Reports Technical Reference Guide
String. Gets or sets the destination Lotus
Domino form name.
(BCC) list for reports e-mailed to a VIM email account.
list for reports e-mailed.
included with e-mailed reports.
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
None
None
None
None
Ta b le 40 :
2 Report Designer Component Object Model
PropertyDescription
MailSubjectString. Gets or sets the e-mail subject
heading for reports being e-mailed.
MailToListString. Gets or sets the To list for reports
being e-mailed.
MailUserNameString. Gets or sets mail user name.Read
NumberOfLinesPe
rPage
ODBCDataSource
Name
ODBCDataSourceP
assword
ODBCDataSource
UserID
Integer. Gets or sets the number of lines to
appear per page option for reports
exported to a paginated text format.
String. Gets or sets the ODBC data source
for reports exported to ODBC.
String. Sets the ODBC data source
password.
String. Gets or sets the user name used to
access an ODBC data source for reports
exported to ODBC.
Read/
Write
Read
/
Wri te
Read
/
Wri te
/
Wri te
Read
/
Wri te
Read
/
Wri te
Wri te
only
Read
/
Wri te
Restriction in event
handler
None
None
None
None
None
None
None
ODBCExportTable
Name
Parent“Report Object”. Reference to the parent
PDFExportAllPagesBoolean. Gets or sets whether or not to
Crystal Reports Technical Reference Guide71
String. Gets or sets the database table in
the ODBC data source that the report file
exported to ODBC will be appended to.
You can also create a new table using this
property.
object.
export all pages of the report to Portable
Document Format(PDF).
PDFExportAllPages must be set to false
when setting PDFFirstPageNumber and
PDFLastPageNumber.
Read
/
Wri te
Read
only
Read
/
Wri te
None
None
None
ExportOptions Object
Ta b le 40 :
PropertyDescription
PDFFirstPageNum
ber
PDFLastPageNum
ber
RTFExportAllPagesBoolean. Gets or sets whether or not to
RTFFirstPageNum
ber
RTFFLastPageNu
mber
Long. Gets or sets the start page, of a page
export range, when exporting to PDF.
PDFExportAllPages must be set to False
or this value is ignored.
Long. Gets or sets the end page, of a page
export range, when exporting to PDF.
PDFExportAllPages must be set to False
or this value is ignored.
export all pages of the report to Rich Text
Format(RTF). RTFExportAllPages must be
set to false when setting
RTFFirstPageNumber and
RTFLastPageNumber.
Long. Gets or sets the start page, of a page
export range, when exporting to RTF.
RTFExportAllPages must be set to False
or this value is ignored.
Long. Gets or sets the end page, of a page
export range, when exporting to RTF.
RTFExportAllPages must be set to False
or this value is ignored.
Read/
Write
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Restriction in event
handler
None
None
None
None
None
UseDefaultCharact
ersPerInch
UserDefinedChara
ctersPerInch
UseReportDateFor
mat
72Crystal Reports Technical Reference Guide
Boolean. Gets or sets use default
characters per inch option.
Long. Gets or sets user defined characters
per inch.
Boolean. Gets or sets whether the date
format used in the report should also be
used in the exported report. Can be used
for Data Interchange Format (DIF),
Record Style Format, and comma, tab, or
character separated format.
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
None
None
None
Ta b le 40 :
2 Report Designer Component Object Model
PropertyDescription
UseReportNumber
Format
XMLAllowMultipl
eFiles
XMLFileNameString. Gets or sets the file name if the
Boolean. Gets or sets whether the number
format used in the report should also be
used in the exported report. Can be used
for Data Interchange Format (DIF),
Record Style Format, and comma, tab, or
character separated format.
Boolean. Gets or sets allow multiple files,
when exporting to XML. When set to True
the Schema file for the report will be
exported along with the XML file. The
Schema file will be either an XML schema
(.xsd) or a Document Type Definition
(.dtd), depending on the options selected
in the XML Forma dilaog box. For more
information see “Customizing XML
report definitions” in the Crystal Reports
User’s Guide
report is exported to a disk.
Remarks
For backwards compatibility the FormatDllName and DestinationDllName
properties return the Internal Name property of the associated DLL. The Internal
Name property of the DLL is found in the DLLs Properties Dialog box under the
Version tab. For a list of export DLLs see “Export Destination” and “Export
Format” in the Runtime help (Runtime.hlp).
Read/
Write
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Restriction in event
handler
None
None
None
ExportOptions Object Methods
The following methods are discussed in this section:
• “PromptForExportOptions Method (ExportOptions Object)” on page 74
• “Reset Method (ExportOptions Object)” on page 75
The PromptForExportOptions method prompts the user for export information
using default Crystal Report Engine dialog boxes.
Crystal Reports Technical Reference Guide73
FieldDefinitions Collection
Syntax
Sub PromptForExportOptions ()
Reset Method (ExportOptions Object)
The Reset method clears all ExportOptions properties.
Syntax
Sub Reset ()
FieldDefinitions Collection
The FieldDefinitions Collection contains the various types of XXXFieldDefinition
Objects (for example, DatabaseFieldDefinition, FormulaFieldDefinition,
SummaryFieldDefinition). For the current release, developers can access the
FieldDefinitions Collection only through the ConditionFields Property of
GraphObject.
FieldDefinitions Collection Properties
Table 41:
PropertyDescription
CountLong. Gets the collection count.Read
Item (index As
Long)
Parent“Report Object”. Reference to the parent object.Read
A field definition object. Gets the collection item.
See Remarks.
Read/
Write
only
Read
only
only
Restriction in
event handler
None
None
None
Remarks
After getting the field definition object from the Item property, you can use the
Kind property to determine what type of field definition object the item is. All field
definition objects have the Kind property.
FieldDefinitions Collection Methods
The following methods are discussed in this section:
74Crystal Reports Technical Reference Guide
2 Report Designer Component Object Model
• “Add Method (FieldDefinitions Collection)” on page 76
• “Delete Method (FieldDefinitions Collection)” on page 76
Add Method (FieldDefinitions Collection)
Use the Add method to add the specified Field to the FieldDefinitions Collection.
Syntax
Sub Add (Field)
Parameter
Table 42:
ParameterDescription
FieldSpecifies the Field that you want to add to the Collection.
Delete Method (FieldDefinitions Collection)
Use the Delete method to remove the specified Field from the FieldDefinitions
Collection.
Syntax
Sub Delete (Field)
Parameter
Table 43:
ParameterDescription
FieldSpecifies the Field that you want to delete from the
Collection.
FieldElement Object
The FieldElement Object represents a field object embedded in a text field. This
object provides properties for retrieving field element information from a text
object (for example, line spacing, the number of decimal places, font color). A
Crystal Reports Technical Reference Guide75
FieldElement Object
FieldElement Object is obtained from the Item property of the “FieldElements
Collection” on page 87.
FieldElement Object Properties
Table 44:
Read
PropertyDescription
AmPmType“CRAMPMType”. Gets or sets the
AM/PM type option.
AmStringString. Gets or sets the AM string.Read
BooleanOutputType“CRBooleanOutputType”. Gets or sets
the Boolean output type.
CharacterSpacingLong. Gets or sets the character
spacing. OLE_COLOR. Gets or sets the
object background color.
ColorOLE_COLOR. Gets or sets the font
color.
ConditionFormulaString. Gets or sets the condition
formula. The condition formula can be
based on recurring records or on
summary fields, but it cannot be based
on print-time fields, such as running
totals or print-time formulas.
Condition formulas cannot have
shared variables.
/
Write
Read
/
Wri te
/
Wri te
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Restriction in event
handler
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle.
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle.
CurrencyPosition
Ty pe
CurrencySymbolString. Gets or sets the currency
76Crystal Reports Technical Reference Guide
“CRCurrencyPositionType”. Gets or
sets the currency position type.
symbol.
Read
/
Wri te
Read
/
Wri te
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle or
active.
Table 44:
2 Report Designer Component Object Model
PropertyDescription
CurrencySymbol
Ty pe
DateCalendarType“CRDateCalendarType”. Gets or sets
DateEraType“CRDateEraType”. Gets or sets the
DateFirstSeparatorString. Gets or sets the date first
DateOrder“CRDateOrder”. Gets or sets the date
DatePrefixSepara
tor
DateSecondSepar
ator
“CRCurrencySymbolType”. Gets or
sets the currency symbol type.
the date calendar type.
date era type.
separator.
order.
String. Gets or sets the date prefix
separator.
String. Gets or sets the date second
separator.
Read
/
Write
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Restriction in event
handler
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle.
Can be written only
when formatting idle.
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle or
active.
DateSuffixSepara
tor
DateWindowsDef
aultType
DayType“CRDayType”. Gets or sets the day
DecimalPlacesInteger. Gets or sets the number
Crystal Reports Technical Reference Guide77
String. Gets or sets the date suffix
separator
“CRDateTimeFieldFormatConditionFo
rmulaType”. Gets or sets the date
windows default type.
type.
decimal places.
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle.
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle or
active.
FieldElement Object
Table 44:
Read
PropertyDescription
DecimalSymbolString. Gets or sets the decimal symbol.Read
DisplayReverseSignBoolean. Gets or sets the reverse sign
FieldDefinitionA field definition object. Gets the field
FirstLineIndentLong. Gets or sets the first line indent.Read
FontIFontDisp. Gets or sets the standard
HourMinuteSepa
rator
HourType“CRHourType”. Gets or sets the hour
option.
definition. See Remarks.
OLE font.
String. Gets or sets the hour minute
separator.
type.
/
Write
/
Wri te
Read
/
Wri te
Read
Only
/
Wri te
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Restriction in event
handler
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle or
active.
None
Can be written only
when formatting idle.
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle or
active.
LeadingDayPosition“CRLeadingDayPosition”. Gets or sets
the leading day position option.
LeadingDaySepa
rator
LeadingDayType“CRLeadingDayType”. Gets or sets the
LeftIndentLong. Gets or sets the left indent, in
78Crystal Reports Technical Reference Guide
String. Gets or sets the leading day
separator.
leading day type.
twips.
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Can be written only
when formatting idle.
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle.
Table 44:
2 Report Designer Component Object Model
Read
PropertyDescription
LineSpacingDouble. Gets the line spacing.Read
LineSpacingType“CRLineSpacingType”. Gets the line
spacing type.
MaxNumberOfLi
nes
MinuteSecondSe
parator
MinuteType“CRMinuteType”. Gets or sets the
MonthType“CRMonthType”. Gets or sets month
NegativeType“CRNegativeType”. Gets or sets
Integer. Gets or sets the maximum
number of line for a string memo field.
String. Gets or sets minute second
separator.
minute type.
type.
number negative type.
/
Write
Only
Read
Only
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Restriction in event
handler
None
None
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle or
active.
Parent“TextObject Object”. Reference to the
parent object.
PmStringString. Gets or sets the PM string.Read
RightIndentLong. Gets or sets the right indent, in
twips.
RoundingType“CRRoundingType”. Gets or sets the
number rounding type.
Crystal Reports Technical Reference Guide79
Read
only
/
Wri te
Read
/
Wri te
Read
/
Wri te
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle.
Can be written only
when formatting idle or
active.
FieldElement Object
Table 44:
PropertyDescription
SecondType“CRSecondType”. Gets or sets the
SuppressBoolean. Gets or sets the object
SuppressIfDuplic
ated
SuppressIfZeroBoolean. Gets or sets the suppress if
TextFormat“CRTextFormat”. Gets or sets the text
ThousandsSepara
tors
ThousandSymbolString. Gets or sets the thousand
seconds type.
visibility.
Boolean. Gets or sets the suppress if
duplicate option.
zero option.
format option for string memo fields.
Boolean. Gets or sets the enable
thousands separators option.
separator symbol.
Read
/
Write
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Restriction in event
handler
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle.
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle or
active.
Tim eBase“CRTimeBase”. Gets or sets the time
UseLeadingZeroBoolean. Gets or sets the number uses
UseOneSymbolP
erPage
UseSystemDefaultsBoolean. Gets or sets the use system
80Crystal Reports Technical Reference Guide
base.
leading zero option.
Boolean. Gets or sets the use one
symbol per page option.
defaults formatting option.
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle or
active.
Table 44:
2 Report Designer Component Object Model
PropertyDescription
Ye ar Typ e“CRYearType”. Gets or sets the year
type.
ZeroValueStringString. Gets or sets the zero value
string for number field format.
Remarks
After getting the field definition object from the FieldDefiniton property, you can
use the Kind property to determine what type of field definition object it is. All
field definition objects have the Kind property.
FieldElement Object Methods
The following method is discussed in this section:
• “SetLineSpacing Method (FieldElement Object)” on page 87
SetLineSpacing Method (FieldElement Object)
Use the SetLineSpacing method to get and set the line spacing and line spacing
type.
Read
/
Write
Read
/
Wri te
Read
/
Wri te
Restriction in event
handler
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle or
active.
Syntax
Sub SetLineSpacing (LineSpacing As Double,
LineSpacingType As CRLineSpacingType)
Parameters
Table 45:
ParameterDescription
LineSpacingSpecifies the line spacing.
LineSpacingTypeSpecifies the line spacing type. Use one of “CRLineSpacingType”.
Crystal Reports Technical Reference Guide81
FieldElements Collection
FieldElements Collection
The FieldElements collection contains the FieldElement objects defined in a text
field. Access a specific object in the collection using the Item property.
FieldElements Collection Properties
Table 46:
PropertyDefinition
CountLong. Gets the number of objects in the collection.Read
Item
(indexAs
Long)
Parent“TextObject Object”. Gets reference to the parent
“FieldElement Object”. Gets an item from the
Collection specified by the parameter index.
object.
Read/
Write
only
Read
only
Read
only
FieldElements Collection Methods
The following methods are discussed in this section:
• “Add Method (FieldElements Collection)” on page 88
• “Delete Method (FieldElements Collection)” on page 88
Add Method (FieldElements Collection)
The Add method is used to add a FieldElement object to the Collection.
Syntax
Function Add (position As Long, Field)
Restriction in
event handler
None
None
None
Table 47:
ParameterDescription
positionSpecifies the index where you would like to add the
FieldSpecifies the FieldElement that you want to add to the Collection.
82Crystal Reports Technical Reference Guide
FieldElement to the Collection.
Delete Method (FieldElements Collection)
Use the Delete method to remove a FieldElement Object from the Collection.
Syntax
Sub Delete (index)
Parameter
ParameterDescription
indexSpecifies the index number of the Object that you want to
remove from the Collection.
FieldMappingData Object
The FieldMappingData Object provides information related to FieldMapping
Events. This Object can be accessed through the Report Object FieldMapping
Event.
2 Report Designer Component Object Model
Table 48:
FieldMappingData Object Properties
Table 49:
PropertyDescriptionRead/Write
FieldNameString. Gets or sets the field name.Read/WriteNone
MappingToFie
ldIndex
TableNameString. Gets or sets field’s table name.Read/WriteNone
Va lu eTy pe“CRFieldValueType”. Gets the value type
Crystal Reports Technical Reference Guide83
Integer. Gets or sets the index of the
mapping to field index in the field list of the
new database.
that is in the field.
Read/WriteNone
Read onlyNone
Restriction in
event handler
FieldObject Object
FieldObject Object
The FieldObject Object represents a field found in a report (for example, special
field, database field, parameter field, etc.). This object provides properties for
retrieving information for a field in your report. A FieldObject Object is obtained
from the Item property of the “ReportObjects Collection” on page 179, (for
example, ReportObjects.Item(Index), where the index can be the 1-based index
number of the item or an Object name).
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle or
active.
CharacterSpacingLong. Gets or sets the character
spacing.
84Crystal Reports Technical Reference Guide
Read
/
Wri te
Can be written only
when formatting idle.
Table 50:
2 Report Designer Component Object Model
PropertyDescription
CloseAtPageBreakBoolean. Gets or sets the close border
on page break option.
ConditionFormulaString. Gets or sets the condition
formula. The condition formula can be
based on recurring records or on
summary fields, but it cannot be based
on print-time fields, such as running
totals or print-time formulas.
Condition formulas cannot have
shared variables.
CssClassString. Gets or sets the cascading style
sheet Class.
CurrencyPosition
Ty pe
CurrencySymbolString. Gets or sets the currency
CurrencySymbol
Ty pe
“CRCurrencyPositionType”. Gets or
sets the currency position type.
symbol.
“CRCurrencySymbolType”. Gets or
sets the currency symbol type.
Read/
Write
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Restriction in event
handler
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle.
Can be written only
when formatting idle.
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle or
active.
DateCalendarType“CRDateCalendarType”. Gets or sets
the date calendar type.
DateEraType“CRDateEraType”. Gets or sets the
date era type.
DateFirstSeparatorString. Gets or sets the date first
separator.
DateOrder“CRDateOrder”. Gets or sets the date
order.
Crystal Reports Technical Reference Guide85
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Can be written only
when formatting idle.
Can be written only
when formatting idle.
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle or
active.
FieldObject Object
Table 50:
PropertyDescription
DatePrefixSeparatorString. Gets or sets the date prefix
separator.
DateSecondSepar
ator
DateSuffixSeparatorString. Gets or sets the date suffix
DateWindowsDef
aultType
DayType“CRDayType”. Gets or sets the day
DecimalPlacesInteger. Gets or sets the number
DecimalSymbolString. Gets or sets the decimal
String. Gets or sets the date second
separator.
separator
“CRDateTimeFieldFormatConditionF
ormulaType”. Gets or sets the date
windows default type.
type.
decimal places.
symbol.
Read/
Write
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Restriction in event
handler
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle.
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle or
active.
DisplayReverseSignBoolean. Gets or sets the reverse sign
option.
EnableTightHoriz
ontal
FieldObject. Gets the field definition object
FirstLineIndentLong. Gets or sets the first line indent.Read
86Crystal Reports Technical Reference Guide
Boolean. Gets or sets the tight
horizontal option.
(for example,
ParameterFieldDefinition Object).
Read
/
Wri te
Read
/
Wri te
Read
only
/
Wri te
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle or
active.
None
Can be written only
when formatting idle.
Table 50:
2 Report Designer Component Object Model
PropertyDescription
FontIFontDisp. Gets or sets the standard
OLE font.
HasDropShadowBoolean. Gets or sets the border drop
shadow option.
HeightLong. Gets or sets object height, in
twips.
HorAlignment“CRAlignment”. Gets or sets the
horizontal alignment.
HourMinuteSepa
rator
HourType“CRHourType”. Gets or sets the hour
KeepTogetherBoolean. Gets or sets the keep object
String. Gets or sets the hour minute
separator.
type.
together option.
Read/
Write
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Restriction in event
handler
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle or
active.
Kind“CRObjectKind”. Gets which kind of
object (for example, box, cross-tab,
field.)
LeadingDayPosition“CRLeadingDayPosition”. Gets or sets
the leading day position option.
LeadingDaySepar
ator
LeadingDayType“CRLeadingDayType”. Gets or sets
Crystal Reports Technical Reference Guide87
String. Gets or sets the leading day
separator.
the leading day type.
Read
only
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
None
Can be written only
when formatting idle.
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle or
active.
FieldObject Object
Table 50:
PropertyDescription
LeftLong. Gets or sets the object upper left
position, in twips.
LeftIndentLong. Gets or sets the left indent, in
twips.
LeftLineStyle“CRLineStyle”. Gets or sets the left
line style.
LineSpacingDouble. Gets the line spacing.Read
LineSpacingType“CRLineSpacingType”. Gets the line
spacing type.
MaxNumberOfLi
nes
MinuteSecondSep
arator
MinuteType“CRMinuteType”. Gets or sets the
Integer. Gets or sets the maximum
number of line for a string memo field.
String. Gets or sets minute second
separator.
minute type.
Read/
Write
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Only
Read
Only
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Restriction in event
handler
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle.
Can be written only
when formatting idle or
active.
None
None
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle or
active.
MonthType“CRMonthType”. Gets or sets month
type.
NameString. Gets or sets the object name.Read
NegativeType“CRNegativeType”. Gets or sets
number negative type.
NextValueVariant. Gets the field next value.Read
88Crystal Reports Technical Reference Guide
Read
/
Wri te
/
Wri te
Read
/
Wri te
only
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle or
active.
Table 50:
2 Report Designer Component Object Model
PropertyDescription
Parent“Section Object”. Reference to the
parent object.
PmStringString. Gets or sets the PM string.Read
PreviousValueVariant. Gets the field previous value.Read
RightIndentLong. Gets or sets the right indent, in
twips.
RightLineStyle“CRLineStyle”. Gets or sets the right
line style.
RoundingType“CRRoundingType”. Gets or sets the
number rounding type.
SecondType“CRSecondType”. Gets or sets the
seconds type.
Read/
Write
Read
only
/
Wri te
only
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Restriction in event
handler
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle.
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle or
active.
SuppressBoolean. Gets or sets the object
visibility.
SuppressIfDuplic
ated
SuppressIfZeroBoolean. Gets or sets the suppress if
TextColorOLE_COLOR. Gets or sets the object
Crystal Reports Technical Reference Guide89
Boolean. Gets or sets the suppress if
duplicate option.
zero option.
text color.
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle or
active.
FieldObject Object
Table 50:
PropertyDescription
TextFormat“CRTextFormat”. Gets or sets the text
format option for string memo fields.
TextRotationAngle“CRRotationAngle”. Gets or sets the
text rotation angle.
ThousandsSepara
tors
ThousandSymbolString. Gets or sets the thousand
Tim eBase“CRTimeBase”. Gets or sets the time
TopLong. Gets or sets the object upper top
TopLineStyle“CRLineStyle”. Gets or sets the top
Boolean. Gets or sets the enable
thousands separators option.
separator symbol.
base.
position, in twips.
line style.
Read/
Write
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Restriction in event
handler
Can be written only
when formatting idle.
Can be written only
when formatting idle.
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle or
active.
UseLeadingZeroBoolean. Gets or sets the number uses
leading zero option.
UseOneSymbolPe
rPage
UseSystemDefaultsBoolean. Gets or sets the use system
ValueVariant. Gets the field current value.Read
90Crystal Reports Technical Reference Guide
Boolean. Gets or sets the use one
symbol per page option.
defaults formatting option.
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Only
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle or
active.
Table 50:
2 Report Designer Component Object Model
PropertyDescription
WidthLong. Gets or sets the object width, in
twips.
Ye ar Typ e“CRYearType”. Gets or sets the year
type.
ZeroValueStringString. Gets or sets the zero value
string for number field format.
FieldObject Object Methods
The following methods are discussed in this section:
• “SetLineSpacing Method (FieldObject Object)” on page 97
• “SetUnboundFieldSource Method (FieldObject Object)” on page 97
SetLineSpacing Method (FieldObject Object)
Use the SetLineSpacing method to get and set the line spacing and line spacing
type.
Syntax
Sub SetLineSpacing (LineSpacing As Double,
LineSpacingType As CRLineSpacingType)
Read/
Write
Read
/
Wri te
Read
/
Wri te
Read
/
Wri te
Restriction in event
handler
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle or
active.
Can be written only
when formatting idle or
active.
Parameters
Ta b le 51 :
ParameterDescription
LineSpacingSpecifies the line spacing.
LineSpacingTypeSpecifies the line spacing type. Use one of “CRLineSpacingType”.
Crystal Reports Technical Reference Guide91
FormattingInfo Object
SetUnboundFieldSource Method (FieldObject Object)
Use the SetUnbound FieldSource Method to bind a DataSource to an unbound
field.
Syntax
Sub SetUnboundFieldSource (pUnboundFieldSource As String)
Parameter
ParameterDescription
Table 52:
pUnboundFieldSourceBSTR specifies the datasouce, Crystal formula format. See Remarks