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

Description

When the Destination property is set "toApplication", the Report will be exported in one of two ways:

1.If the AppName property has a value assigned to it, the Report will be exported to the FileName specified and then the VCL will attempt to open this exported file with the application specified in the AppName property.

2.If the AppName property is blank, the Report will be exported to a temporary file, and the Print Engine will attempt to launch the temporary file using the application associated with the filename extension in the Windows environment.

Example

The following example exports a Report to a defined application:

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

Crpe1.Output := toExport;

Crpe1.Export.Destination := toApplication;

Crpe1.Export.FileType := Dif;

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

Crpe1.Export.AppName := 'C:\Windows\Notepad.exe';

Crpe1.Execute;

The following example exports a Report to application using the Application with the associated extension in the Windows environment (if there is one):

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

Crpe1.Output := toExport;

Crpe1.Export.Destination := toApplication;

Crpe1.Export.FileType := Dif;

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

Crpe1.Export.AppName := '';

Crpe1.Execute;

Export CharSepQuote property

Declaration

property CharSepQuote: TCrFieldCharSeparator;

Type

TCrFieldCharSeparator = string[1];

VCL Reference

256

Description

The CharSepQuote property holds the value of the string field quote-mark character when exporting to CharacterSeparated format. This is the character that is used to specify the start and end of an individual string field. Quotes are not applied to numeric fields. This property works in conjunction with CharSepSeparator.

Example

Exporting to File in CharacterSeparated format:

Crpe1.ReportName := 'C:\Company.rpt'; Crpe1.Output := toExport; Crpe1.Export.Destination := toFile; Crpe1.Export.FileType := CharacterSeparated; Crpe1.Export.FileName := 'C:\MyReport.txt'; {CharSepQoute surrounds string fields} Crpe1.Export.CharSepQuote := '#'; {CharSepSeparator separates fields} Crpe1.Export.CharSepSeparator := '+++'; Crpe1.Execute;

Export CharSepSeparator property

Declaration

property CharSepSeparator: TCrFieldDelimiter;

Type

TCrFieldDelimiter = string[PE_FIELDDELIMLEN];

Constant

PE_FIELDDELIMLEN = 16;

Description

The CharSepSeparator property holds the value of the character(s) used to separate one field from another when exporting to CharacterSeparated format. This works in conjunction with CharSepQuote.

VCL Reference

257

Example

Exporting to File in CharacterSeparated format:

Crpe1.ReportName := 'C:\Company.rpt'; Crpe1.Output := toExport; Crpe1.Export.Destination := toFile; Crpe1.Export.FileType := CharacterSeparated; Crpe1.Export.FileName := 'C:\MyReport.txt'; {CharSepQoute surrounds string fields} Crpe1.Export.CharSepQuote := '#'; {CharSepSeparator separates fields} Crpe1.Export.CharSepSeparator := '+++'; Crpe1.Execute;

Export Destination property

Declaration

property Destination: TCrExportDestination;

Type

TCrExportDestination = (toFile, toEmailViaMapi, toEmailViaVIM, toMSExchange, toApplication);

Description

The Destination property determines what kind of Export destination will be used when a Report is exported for example, when Output is set toExport. There are five options:

Example

toFile

To a Disk File. FileName must be specified if PromptForOptions is False.

 

 

toEmailViaMapi

To an email message on MS Exchange, MS Outlook, etc.

 

 

toEmailViaVIM

To an email message on Lotus Notes mail, etc.

toMSExchange

To an email message in an MS Exchange Folder.

 

 

toApplication

To an Application, either by file extension association, or specified in AppName.

 

 

VCL Reference

258

Exporting to File in ODBCTable format:

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

with Crpe1.Export do begin

Destination := toFile; FileType := ODBCTable; ODBC.Source := 'SQLServer'; ODBC.User := 'Maxwell Smart'; ODBC.Password := 'Agent86'; ODBC.Table := 'ReportTable';

end; Crpe1.Execute;

Export to Email in HTML format:

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

with Crpe1.Export do begin

Destination := toEmailViaMapi; FileType := HTML3;

FileName := 'c:\MyReport.htm'; Email.ToList := 'Maxwell Smart'; Email.CCList := 'The Chief'; Email.Subject := 'Chaos';

Email.Message := 'Would you believe...'; end;

Crpe1.Execute;

Export to Exchange Folder in PaginatedText format:

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

with Crpe1.Export do begin

Destination := toMSExchange; FileType := PaginatedText; LinesPerPage := 25;

Exchange.Profile := 'Microsoft Outlook'; Exchange.Folder := 'Personal Folders@Inbox'; Exchange.Password := 'Agent86';

end; Crpe1.Execute;

VCL Reference

259

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