IDtExcelProvider.DriverVersion

Syntax

DriverVersion: String;

Description

The DriverVersion property determines version of the driver used to work with the file.

Comments

As a value of the property the following values are available:

NOTE. On specifying the driver for Microsoft Office 2007-2010 depending on the file type, which is used to work with (XLSX, XLSB, XLSM), the postfix should be added to the driver name (XML, Macro). A more detailed information about available postfixes can be obtained in documentation describing formation of connection strings when working with Microsoft Office 2007-2010.

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;

//Save provider

EtlProvider.Save;

//End of provider 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 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