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

Example

The following example runs a Report to Window. When the Window is closed, the Print Job is also closed:

procedure TForm1.RunReport; begin

Crpe1.ReportName := 'C:\Report1.rpt'; Crpe1.Output := toWindow; Crpe1.Execute;

end;

procedure TForm1.Crpe1OnJobOpened(const JobNum: Word); begin

ShowMessage('PrintJob opened successfully'); end;

OnPrintEnded event

Declaration

property OnPrintEnded: TNotifyEvent;

Type

TNotifyEvent = procedure(Sender: TObject) of object;

Description

The OnPrintEnded event takes place within the Execute method, after the Crystal component values have been sent to the Crystal Reports Print Engine, and after the Report has been run.

See Execute for a fuller explanation of the order of events.

Example

The following example runs a Report to Printer. When the Job is finished, the Print Job is also closed:

procedure TForm1.RunReport; begin

Crpe1.ReportName := 'C:\Report1.rpt'; Crpe1.Output := toPrinter; Crpe1.Execute;

end;

procedure TForm1.Crpe1OnPrintEnded(Sender: TObject); begin

Crpe1.CloseJob; end;

VCL Reference

174

OnPrinterSend event

Declaration

property OnPrinterSend: TCrpeCancelEvent;

Type

TCrpeCancelEvent = procedure(Sender: TObject; var Cancel: Boolean) of object;

Description

The OnPrinterSend event occurs just before the Printer property values are sent to the Crystal Reports Print Engine. Putting an event here allows the developer a "last chance" to over-ride any Printer DevMode settings that the VCL may be changing via properties such as Orientation and PreserveRptSettings. This event should not be required under normal circumstances.

NOTE: Setting the Cancel parameter to true will cause the Printer.Send to abort. If this is done during the Crpe1.Execute method, execution of the Report will also stop.

Example

The following example shows how the OnPrinterSend event can be used to over-ride DevMode settings:

procedure TForm.Crpe1OnPrinterSend(Sender: TObject; var Cancel: Boolean); begin

TCrpe(Sender).Printer.PMode^.dmCopies := 3; end;

OnWindowClose event

Declaration

property OnWindowClose : TNotifyEvent;

Type

TNotifyEvent = procedure(Sender: TObject) of object;

Description

The OnWindowClose event takes place within the Execute method, after the Crystal component values have been sent to the Crystal Reports Print Engine, and after the Report has been run.

See Execute method, Page 142, for a fuller explanation of the order of events.

VCL Reference

175

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