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

Description

DateTimeToStr is used internally in the Crystal component but has been exposed for general purpose use. It takes a DateTime value and returns a string ('YYYY,MM,DD HH:NN:SS'). If the "bMSec" parameter is true, milliseconds are added to the end of the Time part of the string.

str1 := Crpe1.DateTimeToStr(Now, False);

{str1 now looks something like this: '1999,01,01 12:02:31'}

str1 := Crpe1.DateTimeToStr(Now, True);

{str1 now looks something like this: '1999,01,01 12:02:31.000'}

DateToStr method

Declaration

function DateToStr(const dValue: TDateTime): string;

Description

DateToStr is used internally in the Crystal component but has been exposed for general purpose use. It takes a DateTime value and returns a string ('YYYY,MM,DD').

str1 := Crpe1.DateToStr(Now);

{str1 now looks something like this: '1999,01,01'}

Destroy method

Declaration

destructor Destroy; override;

Description

The Destroy method frees the Crystal component. It is used internally in the VCL component and should not be called outside of the component. If you are creating the component dynamically at run-time, use the Free method to release the component from memory.

VCL Reference

139

ExportWindow method

Declaration

procedure ExportWindow(const bMail: Boolean);

Description

The ExportWindow procedure sends the Report that is displayed in the current Preview Window to an Export destination. This procedure will not use the Export settings of the component but will instead prompt the user for the Export Options (FileType, FileName, etc.), in the same way as when the Export button on the Crystal Button Bar is clicked.

The "bMail" boolean determines if the first prompt will come up defaulted to Email as the Destination:

If bMail is True, Email will come up as default.

·If bMail is False, Diskfile will appear as the default.

This method is particularly useful when building a custom button bar to simulate the Export Button that appears on the Preview Window button bar.

Example

The following example runs a Report to Window. When a button on the application is pressed, the Window is exported:

Crpe1.ReportName := 'MyReport.rpt';

Crpe1.Output := toWindow;

Crpe1.Execute;

{When an Export button is pressed do...} Crpe1.ExportWindow;

ExDateStr method

Declaration

function ExDateStr(sValue: string; var sYear, sMonth, sDay: string): boolean;

VCL Reference

140

Description

ExDateStr is used internally in the Crystal component but has been exposed for general purpose use. It takes a Date string value and passes the individual parts into the Year/Month/Day var parameters.

var

 

sDate

: string;

sY,sM,sD : string; begin

sDate := '1998,02,03';

if Crpe1.ExDateStr(sDate, sY, sM, sD) then ShowMessage('Y/M/D strings extracted successfully!');

end;

{sY = '1998'; sM = '02'; sD = '03'}

ExDateTimeStr method

Declaration

function ExDateTimeStr(sValue: string; var sYear, sMonth, sDay, sHour, sMin, sSec: string): boolean;

Description

ExDateTimeStr is used internally in the Crystal component, but has been exposed for general purpose use. It takes a DateTime string value and passes the individual parts into the Year/Month/Day Hour/Min/Sec var parameters.

var

sDateTime : string; sY,sM,sD,

sH,sN,sS : string; begin

sDateTime := '1998,02,03 12:22:23';

if Crpe1.ExDateTimeStr(sDateTime, sY, sM, sD, sH, sN, sS) b ShowMessage('Y/M/D H/M/S strings extracted successfully!');

end;

{sY = '1998'; sM = '02'; sD = '03'; sH = '12'; sN = '22'; sS = '23'}

VCL Reference

141

Execute method

Declaration

function Execute: Boolean;

Description

The Execute method starts running the Report. Internally it runs through a number of steps:

1Checks to see if it is being called from OnExecuteBegin, OnExecuteDoneSend, OnExecuteEnd, OnPrintEnded, OnWindowClose events. If so, it exits since you cannot call Execute from an event inside the Execute method.

2If Output is set to go toExport, and the Export property, PromptOnOverwrite, is set to True, check to see if the Export FileName exists. If it does, throw up a warning dialog box.

3Make sure the Print Job is open.

4Store the current Report number (in case we are on a Subreport), so we can restore it when finished.

5Check to see if the Subreports SubExecute property is True. If we are currently on a Subreport, and SubExecute is True, the Subreport will be run. Otherwise, the main Report will be run.

6Do the OnExecuteBegin event (if there is one).

7If SendOnExecute is True, loop through the Subreports, starting from highest number down to main Report and make the following calls (if SubExecute is True, we only loop once, making the calls to the current Subreport):

SendDiscardSavedData;

{Sends either Connect or LogOnInfo} Tables.Send;

SessionInfo.Send;

SQL.FParams.Send;

ParamFields.Send;

SQL.Expressions.Send; SQL.Send; {SQL Query}

{if FieldMapping is not fmAuto, do VerifyDatabase} Formulas.Send;

SortFields.Send;

GroupSortFields.Send;

GroupCondition.Send;

GroupOptions.Send;

Selection.Send;

GroupSelection.Send;

SectionHeight.Send;

SectionFont.Send;

VCL Reference

142

SectionFormat.Send;

SectionFormatFormulas.Send;

AreaFormat.Send;

AreaFormatFormulas.Send;

GraphType.Send;

GraphText.Send;

GraphOptions.Send;

GraphData.Send;

PrintDate.Send;

Margins.Send;

SendDetailCopies;

{These properties are set only once: either for the Main Report, or for the Subreport if SubExecute is True}

SummaryInfo.Send;

ReportOptions.Send;

PrintOptions.Send;

Printer.Send;

SendProgressDialog;

SendDialogParent;

if (Output = toWindow) then begin

WindowButtonBar.Send;

WindowCursor.Send end;

SendOutput;

SendReportTitle;

8Do the OnExecuteDoneSend Event, if there is one.

9Set up the WindowEvents callback function for any assigned Window Events.

10Run the Report.

11If the Output is set to go toWindow, send in the WindowZoom settings:

if (Output = toWindow) then WindowZoom.Send;

12Check the OnExecuteEnd event, if there is one.

13Check the OnWindowClose event, if there is one.

14Check the OnPrintEnded event, if there is one.

15Restore the internal pointer to the current Subreport.

VCL Reference

143

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