HasHeader: Boolean;
The HasHeader property determines whether fields header list is downloaded from the first file row.
By default the property is set to True, while fields header list is downloaded from the first file row.
Executing the example requires that the repository contains an ETL task with the ETL identifier and an Excel file named Data.xls in the root directory of the C disk.
Add links to the Andy, Drawing, Dt, Etl, and Metabase system assemblies.
Sub UserProc;
Var
MB: IMetabase;
MObj: IMetabaseObject;
EtlTask: IEtlTask;
EtlProvider: IEtlPlainDataProvider;
ExcelProvider: IDtExcelProvider;
WxProvider: IWxRectangle;
WxETLProvider: IWxETLObject;
Begin
MB := MetabaseClass.Active;
//Get ETL task
MObj := MB.ItemById("ETL").Edit;
EtlTask := MObj As IEtlTask;
//Create the "Import from Excel"
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 source
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 source
EtlProvider.Save;
//Start creating a visual object
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;
//Save ETL task
MObj.Save;
End Sub UserProc;
After executing the example the Import From Excel object is created in the ETL task . This data source imports all data from the Data.xls Excel file from the Sheet1 sheet. 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: