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

Export PromptOnOverwrite property

Declaration

property PromptOnOverwrite: boolean;

Description

PromptOnOverwrite can be used to warn the user if the file that is being exported to already exists. It is only active if the Destination is toFile. If PromptOnOverwrite is True, and the file specified in FileName already exists, the following dialog box will appear:

Example

The following code will export a Report to file, and prompt the user if the file exists already:

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

Crpe1.Output := toExport;

Crpe1.Export.Destination := toFile;

Crpe1.Export.FileType := Ascii;

Crpe1.Export.FileName := 'C:\Company.txt';

Crpe1.Export.PromptOnOverwrite := True;

Crpe1.Execute;

Export UseRptDateFmt property

Declaration

property UseRptDateFmt: Boolean;

VCL Reference

286

Description

When exporting a Report, the UseRptDateFmt property indicates whether or not the dates should be exported in the same date format (MDY, DMY, etc.) that is used in the Report or instead optimize the dates for the file format that has been selected. This property applies only when FileType is set to one of the following:

Records

TabSeparated

Dif

Csv

CharacterSeparated

By default, the UseRptDateFmt property is set to True.

Example

The following code shows how to export to File in DIF format. The Number and Date formats will be optimized for the file format, regardless of how they are formatted in the Report:

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

Crpe1.Output := toExport;

Crpe1.Export.Destination := toFile;

Crpe1.Export.FileType := Dif;

Crpe1.Export.FileName := 'C:\Company.dif';

Crpe1.Export.UseRptDateFmt := False;

Crpe1.Export.UseRptNumberFmt := False;

Crpe1.Execute;

Export UseRptNumberFmt property

Declaration

property UseRptNumberFmt: Boolean;

Description

When exporting a Report, UseRptNumberFmt indicates whether or not the numbers in the exported file will retain the same format (decimal places, negatives, etc.) used in the Report, or instead optimize the numbers for the file format that has been selected. This property only applies when PrintFileType is set one of the following types:

Records

TabSeparated

Dif

Csv

CharacterSeparated

By default, the UseRptNumberFmt property is set to True.

VCL Reference

287

Example

The following code shows how to export to File in DIF format. The Number and Date formats will be optimized for the file format, regardless of how they are formatted in the Report:

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

Crpe1.Output := toExport;

Crpe1.Export.Destination := toFile;

Crpe1.Export.FileType := Dif;

Crpe1.Export.FileName := 'C:\Company.dif';

Crpe1.Export.UseRptDateFmt := False;

Crpe1.Export.UseRptNumberFmt := False;

Crpe1.Execute;

Export Methods

Export Clear method

Declaration

procedure Clear;

Description

This method can be used to set the Export properties back to their default values. These defaults consist of clearing all the string fields, and setting the following properties:

FileName

:= '';

 

FileType

:= Ascii;

 

Destination

:= toFile;

 

CharSepQuote

:= '';

 

CharSepSeparator

:= '';

 

UseRptNumberFmt

:= TCRPE_DEFAULT_USERPTNUMBERFMT;

{True}

UseRptDateFmt

:= TCRPE_DEFAULT_USERPTDATEFMT;

{True}

LinesPerPage

:= TCRPE_DEFAULT_LINESPERPAGE;

{60}

ColumnHeadings

:= False;

 

PromptForOptions

:= False;

 

PromptOnOverwrite

:= False;

 

Email.Clear;

 

 

Exchange.Clear;

 

 

ODBC.Clear;

 

 

It is called automatically if the Clear method is called for the main component, but may be called in code as needed.

VCL Reference

288

Example

This line of code clears the Export properties:

Crpe1.Export.Clear;

Export CopyFrom method

Declaration

function CopyFrom(Source: TCrpeExport): boolean;

Description

The CopyFrom method copies the Export property values from another TCrpeExport 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 Export property values to a temporary TCrpeExport object:

var

tempExport : TCrpeExport; begin

tempExport := TCrpeExport.Create; tempExport.CopyFrom(Crpe1.Export);

{...later, when finished with the temp object...} tempExport.Free;

end;

Export Create method

Declaration

constructor Create;

Description

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

VCL Reference

289

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