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

Example

Export to Email in HTML format:

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

with Crpe1.Export do begin

Destination := toEmailViaVIM; FileType := HTML3;

FileName := 'C:\MyReport.htm'; Email.ToList := 'Maxwell Smart'; Email.CCList := 'The Chief'; Email.VIMBCCList := 'Agent99; Heimi'; Email.Subject := 'Chaos';

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

Crpe1.Execute;

Export Email Clear method

Declaration

procedure Clear;

Description

This method can be used to set the Email properties to their default values:

ToList

:= '';

CCList

:= '';

VIMBCCList

:= '';

Subject

:= '';

Message

:= '';

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

Example

This line of code clears the Email properties:

Crpe1.Export.Email.Clear;

VCL Reference

264

Export Email CopyFrom method

Declaration

function CopyFrom(Source: TCrpeExportEmail): boolean;

Description

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

var

tempEmail : TCrpeExportEmail; begin

tempEmail := TCrpeExportEmail.Create; tempEmail.CopyFrom(Crpe1.Export.Email); {...later, when finished with the temp object...} tempEmail.Free;

end;

Export Excel5Ext property

Declaration

property Excel5Ext: TCrpeExportExcel5Ext;

Type

TCrpeExportExcel5Ext = class(TPersistent)

Description

Only available with SCR 7.0 and higher. The Excel5Ext object contains the properties that apply when exporting a Report to Excel5Extended.

The ColumnHeadings property determines if the exported Excel File will have Column Headings or not.

The ColumnWidth property determines how the column width is calculated on a Report exported to Excel5Extended. If it is set to ByArea, then the column width is determined by the Area property setting. If it is set to ByConstant, then the column width is determined by the Constant property setting. Area allows Crystal to set the width based on the objects in a certain Report area; Constant allows the programmer to hard-code a column width value.

VCL Reference

265

The Area property specifies the Report Section whose objects will be used to determine the column widths of the exported Excel file (if ColumnWidth is set to ByArea).

The Constant property determines the column width on a Report exported to Excel5Extended if ColumnWidth is set to ByConstant.

The TabularFormat property determines if all the objects in one area in a Report will be arranged into one row (when TabularFormat is True), or whether they will be split into separate rows (when TabularFormat is False).

The Clear method can be used to set the Excel5Ext object back to it's default property values.

The CopyFrom method can be used to copy the Excel5Ext property values to another Excel5Ext object (for temporary storage).

Example

Exporting to File in Excel5Extended format:

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

Crpe1.Output := toExport;

Crpe1.Export.Destination := toFile;

Crpe1.Export.FileType := Excel5Extended;

Crpe1.Export.Excel5Ext.ColumnHeadings := True;

Crpe1.Export.Excel5Ext.ColumnWidth := ByArea;

Crpe1.Export.Excel5Ext.Area := 'D';

Crpe1.Export.Excel5Ext.TabularFormat := True;

Crpe1.Execute;

Export Excel5Ext Area property

Declaration

property Area: string;

Description

The Area property specifies the Report Section whose objects will be used to determine the column widths of the exported Excel file. The ColumnWidth property must also be set to ByArea for this property to have effect.

The Area name syntax is the same as the Short Section Names used in the Crystal Reports Designer:

RH

Report Header

PH

Page Header

 

 

GH

Group Header

 

 

VCL Reference

266

D

Details

GF

Group Footer

PF

Page Footer

 

 

RF

Report Footer

 

 

Numbers are used to designate different Groups: GH1, GF2, etc. See About Section Names, Volume 1, Chapter 7, for more details on the syntax.The default setting for the Area property is "D" (Details).

Example

Exporting to File in Excel5Extended format. The Column Width is determined by the Details area of the Report:

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

Crpe1.Output := toExport;

Crpe1.Export.Destination := toFile;

Crpe1.Export.FileType := Excel5Extended;

Crpe1.Export.Excel5Ext.ColumnHeadings := True;

Crpe1.Export.Excel5Ext.ColumnWidth := ByArea;

Crpe1.Export.Excel5Ext.Area := 'D';

Crpe1.Export.Excel5Ext.TabularFormat := True;

Crpe1.Execute;

Export Excel5Ext ColumnHeadings property

Declaration

property ColumnHeadings: boolean;

Description

Setting ColumnHeadings to True will cause the exported Excel spreadsheet to have Column Headings.

Example

Exporting to File in Excel5Extended format with column headings:

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

Crpe1.Output := toExport;

Crpe1.Export.Destination := toFile;

Crpe1.Export.FileType := Excel5Extended;

Crpe1.Export.Excel5Ext.ColumnHeadings := True;

Crpe1.Export.Excel5Ext.ColumnWidth := ByArea;

Crpe1.Export.Excel5Ext.Area := 'D';

Crpe1.Export.Excel5Ext.TabularFormat := True;

Crpe1.Execute;

VCL Reference

267

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