DriverVersion: String;
The DriverVersion property determines version of the driver used to work with the file.
As a value of the property the following values are available:
Excel 3.0.
Excel 4.0.
Excel 5.0.
Excel 8.0 - MS Office 97-2003.
Executing the example requires that the repository contains an ETL task with the Etl identifier.
Sub Main;
Var
MB: IMetabase;
MObj: IMetabaseObject;
EtlTask: IEtlTask;
EtlConsumer: IEtlPlainDataConsumer;
ExcelConsumer: IDtExcelConsumer;
WxConsumer: IWxRectangle;
WxETLConsumer: 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 source creation
//The Export To Excel object creation
EtlConsumer := EtlTask.Create(EtlObjectType.PlainDataExcelConsumer) As IEtlPlainDataConsumer;
EtlConsumer := EtlConsumer.Edit;
EtlConsumer.Id := "Excel_Consumer";
EtlConsumer.Name := quot;Export to Excelquot;;
EtlConsumer.Description := "Export to Excel";
//Data source setting
ExcelConsumer := EtlConsumer.Consumer As IDtExcelConsumer;
ExcelConsumer.File := "c:\DataOut.xls";
ExcelConsumer.Table := quot;OutputDataquot;;
ExcelConsumer.DriverVersion := "Excel 8.0";
//Saving the source
EtlConsumer.Save;
//End of source creation
//Start of visual object creation
WxConsumer := EtlTask.Workspace.CreateRectangle;
WxETLConsumer := New WxETLObject.Create;
WxETLConsumer.ETLObject := EtlConsumer;
WxConsumer.Style.TextPosition := WxTextPosition.Bottom;
WxConsumer.Style.PictureMarginTop := -10;
WxConsumer.PinPosition := New GxPointF.Create(50, 50);
WxConsumer.Extension := WxETLConsumer As IWxShapeExtension;
//End of visual object creation
//Save Etl task
MObj.Save;
End Sub Main;
After executing the example the Export to Excel object is created in the ETL task. The consumer exports data into the DataOut.xls Excel file. If such file does not exist, it is created. The name of the sheet, to which export is performed is OutputData. The Excel 8.0 drivers are used for connection.
See also: