IDtExcelProvider.ImexMode

Syntax

ImexMode: DtExcelImexMode;

Description

The ImexMode property determines the mode, in which import from the columns, that contain data of different types, is executed.

Example

Executing the example requires an ETL task with the Etl identifier in repository and Excel file named Data.xls in the disk C root directory.

Sub Main;

Var

MB: IMetabase;

MObj: IMetabaseObject;

EtlTask: IEtlTask;

EtlProvider: IEtlPlainDataProvider;

ExcelProvider: IDtExcelProvider;

WxProvider: IWxRectangle;

WxETLProvider: IWxETLObject;

Begin

MB := MetabaseClass.Active;

//ETL task search. Repository object with the ETL identifier

MObj := MB.ItemById("Etl").Edit;

EtlTask := MObj As IEtlTask;

//Start of the provider creation

//The Import From Excel object creation

EtlProvider := EtlTask.Create(EtlObjectType.PlainDataExcelProvider) As IEtlPlainDataProvider;

EtlProvider := EtlProvider.Edit;

EtlProvider.Id := "Excel_Provider";

EtlProvider.Name := "Import from Excel";

EtlProvider.Description := "Import from Excel";

//Set up data provider

ExcelProvider := EtlProvider.Provider As IDtExcelProvider;

ExcelProvider.DriverVersion := "Excel 8.0";

ExcelProvider.File := "c:\Data.xls";

ExcelProvider.HasHeader := True;

ExcelProvider.ImexMode := DtExcelImexMode.Import;

ExcelProvider.Query := "Select * From [Sheet1$]";

EtlProvider.FillDefault;

//Saving the source

EtlProvider.Save;

//End of source creation

//Start of visual object creation

WxProvider := EtlTask.Workspace.CreateRectangle;

WxETLProvider := New WxETLObject.Create;

WxETLProvider.ETLObject := EtlProvider;

WxProvider.Style.TextPosition := WxTextPosition.Bottom;

WxProvider.Style.PictureMarginTop := -10;

WxProvider.PinPosition := New GxPointF.Create(50, 50);

WxProvider.Extension := WxETLProvider As IWxShapeExtension;

//End of visual object creation

//Save Etl task

MObj.Save;

End Sub Main;

After executing the example the Import From Excel object is created in the ETL task . The data provider imports all the data from the Data.xls Excel file. Sheet name is Sheet1. The Excel 8.0 drivers are used for connection. Field names are imported from the first file row. Fields that contain data of different types are imported entirely.

See also:

IDtExcelProvider