Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
163
Добавлен:
11.05.2015
Размер:
4.73 Mб
Скачать

PrintOptions CopyFrom method

Declaration

function CopyFrom(Source: TCrpePrintOptions): boolean;

Description

The CopyFrom method copies the PrintOptions property values from another TCrpePrintOptions object. It is similar to Delphi's Assign method. It is useful for transferring or temporary storage of values.

Example

The following example copies all the PrintOptions property values to a temporary TCrpePrintOptions object:

var

tempPrintOptions : TCrpePrintOptions; begin

tempPrintOptions := TCrpePrintOptions.Create; tempPrintOptions.CopyFrom(Crpe1.PrintOptions); {...later, when finished with the temp object...} tempPrintOptions.Free;

end;

PrintOptions Create method

Declaration

constructor Create;

Description

The Create method is used internally in the Crystal component and does not need to be called in code.

PrintOptions Retrieve method

Declaration

function Retrieve: boolean;

VCL Reference

512

Description

The Retrieve method obtains the PrintOptions information from the Report. Returns True if the call succeeded.

Example

The following example retrieves the PrintOptions settings from a Report, and changes the Collation setting if needed:

Crpe1.ReportName := 'C:\Company.rpt'; Crpe1.Destination := toPrinter; Crpe1.PrintOptions.Retrieve;

if Crpe1.PrintOptions.Copies > 1 then Crpe1.PrintOptions.Collation := Collated;

Crpe1.Execute;

PrintOptions Send method

Declaration

function Send: TCrBoolean;

Type

TCrBoolean = (cFalse, cTrue, cDefault);

Description

The Send method sends the PrintOptions values to the Crystal Reports Print Engine. This method is called automatically when the Execute method is called, provided that SendOnExecute is set to True. There are three possible return values:

cFalse - Cancel was chosen on the PrintOptions dialog (PromptForOptions is set to True).

cTrue - The PrintOptions were sent to the Print Engine successfully.

cDefault - The PrintOptions were not sent because the properties had not changed from the Report settings, or there was an error (an error would normally raise an exception).

If PromptForOptions is set to True, the Send method can be used to trigger the display of the PrintOptions dialog before Execute is called, although it is not necessary, since Execute will call the Print Options' Send method anyway. If you decide to use the Send method before Execute is called, be sure to turn PromptForOptions off after the dialog box appears, or else it will appear again later when Execute is called.

NOTE: It is strongly recommended that you leave SendOnExecute to True, and let the Crystal Reports component send the values to the Print Engine. If you set the SendOnExecute property to False, each Sub-class and each property that does not belong to a Sub-class must be manually sent before calling the Execute method. This feature is mainly provided for debugging purposes.

VCL Reference

513

Example

In this example, the PrintOptions settings are sent from the Crystal component to the Crystal Reports Print Engine DLL. This is normally handled automatically in the Execute method:

Crpe1.ReportName := 'C:\Company.rpt'; Crpe1.Output := toPrinter; Crpe1.PrintOptions.PromptForOptions := True; {If Cancel was not chosen on the prompt dialog} if Crpe1.PrintOptions.Send <> cFalse then

Crpe1.Execute;

Records Methods

Records Printed method

Declaration

function Printed: LongInt;

Description

The Printed method returns the number of Records that have been printed as the Report is processing. When going to Preview Window, only the first Page will be initially drawn, so this method will return the number of Records that have been printed on the first Page only. As the Pages are navigated, the Printed method will increment to include the new Records that are printed for each Page.

Records Read method

Declaration

function Read: LongInt;

Description

The Read method returns the number of Records that have been read as the Report is processing.

VCL Reference

514

Records Selected method

Declaration

function Selected: LongInt;

Description

The Selected method returns the number of Records that have been selected as the Report is processing. The value returned by this method will be dependant on the Selection Formula in the Report. If there is no Record Selection, Selected will return the same value as Read.

The ProgressDialog can be replaced with a User-Defined dialog by setting ProgressDialog property to False, and creating a dialog that displays the values of the Records object after the Report has been started (Execute was called).

ReportOptions Properties

ReportOptions CaseInsensitiveSQLData property

Declaration

property CaseInsensitiveSQLData: TCrBoolean;

Type

TCrBoolean = (cFalse, cTrue, cDefault);

Description

The CaseInsensitiveSQLData property specifies whether or not the SQL field names used in the Report will be treated with case-sensitivity.

Example

This example sets the CaseInsensitiveSQLData property of ReportOptions:

Crpe1.ReportName := 'C:\Company.rpt';

Crpe1.ReportOptions.CaseInsensitiveSQLData := cTrue;

Crpe1.Output := toWindow;

Crpe1.Execute;

VCL Reference

515

Соседние файлы в папке crystal