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

Example

The following code shows how to get the Latest Page of a Report:

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

Crpe1.Output := toWindow;

Crpe1.Execute;

ShowMessage(IntToStr(Crpe1.Pages.GetLatest));

Pages GetStart method

Declaration

function GetStart: Word;

Description

GetStart will return the number of the first Page that was built when the Report was run. When going to Preview Window, this will always be 1, but when going to Printer, if the PrintOptions.StartPage value is greater than 1, GetStart will return that value.

Example

The following code shows how to get the Start Page of a Report. When going to Printer, this value can be something other than 1:

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

Crpe1.Output := toPrinter;

Crpe1.PrintOptions.StartPage := 2;

Crpe1.Execute;

ShowMessage(IntToStr(Crpe1.Pages.GetStart));

Pages GoToPage method

Declaration

procedure GoToPage(const Value: smallint);

Description

The GoToPage method causes the Preview Window to go to the specified Page of the Report. Specifying a Page number that is greater than the number of Pages in the current Report will result in an error: "Error 550: Invalid Page Number".

VCL Reference

435

Example

The following code shows how to use the GoToPage property to set the displayed Page:

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

Crpe1.Output := toWindow;

Crpe1.Execute;

Crpe1.Pages.GoToPage(3)

Pages Last method

Declaration

procedure Last;

Description

The Last method causes the Preview Window to go to the last Page of the Report. This method can be used to simulate the action of the Last Page button on the Preview Window.

Example

The following code shows how to use the Last method to go to the last Page of a Report:

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

Crpe1.Output := toWindow;

Crpe1.Execute;

Crpe1.Pages.Last;

Pages Next method

Declaration

procedure Next;

Description

The Next method causes the Preview Window to go to the next Page of the Report. This method can be used to simulate the action of the Next Page button on the Preview Window.

VCL Reference

436

Example

The following code shows how to use the Next method to go to the next Page of a Report:

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

Crpe1.Output := toWindow;

Crpe1.Execute;

Crpe1.Pages.Next;

Pages Previous method

Declaration

procedure Previous;

Description

The Previous method causes the Preview Window to go to the previous Page of the Report. This method can be used to simulate the action of the Previous Page button on the Preview Window.

Example

The following code shows how to use the Previous method to go to the previous Page of a Report:

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

Crpe1.Output := toWindow;

Crpe1.Execute;

Crpe1.Pages.GoToPage(3);

Crpe1.Pages.Previous;

ParamFields Properties

ParamFields AsBoolean property

Declaration

property AsBoolean: boolean;

Description

The AsBoolean property is run-time only and can be used to read and write the ParamFields.Value property with native Delphi boolean values. Whereas the Value property holds the ParamFields value as a string, AsBoolean will return the value as a boolean type, or can be written to with a boolean type.

VCL Reference

437

Example

This example uses the AsBoolean property to pass in a native Delphi boolean variable to the ParamFields Value property:

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

Crpe1.ParamFields.Retrieve;

Crpe1.ParamFields[0].AsBoolean := True;

Crpe1.Execute;

ParamFields AsCurrency property

Declaration

property AsCurrency: currency;

Description

The AsCurrency property is run-time only and can be used to read and write the ParamFields.Value property with native Delphi currency values. Whereas the Value property holds the ParamFields value as a string, AsCurrency will return the value as a currency type, or can be written to with a currency type.

Example

This example uses the AsCurrency property to pass in a native Delphi currency variable to the ParamFields Value property:

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

Crpe1.ParamFields.Retrieve;

Crpe1.ParamFields[0].AsCurrency := 1.23;

Crpe1.Execute;

ParamFields AsDate property

Declaration

property AsDate: TDateTime;

Description

The AsDate property is run-time only and can be used to read and write the ParamFields.Value property with native Delphi DateTime values. Whereas the Value property holds the ParamFields value as a string, AsDate will return the value as a datetime type, or can be written to with a datetime type.

VCL Reference

438

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