IExcelDataset.DataSourceName

Syntax

DataSourceName: String;

Description

The DataSourceName property determines the name of data source (sheet, range).

Example

Sub Main;

Var

Des: IMetabaseObjectDescriptor;

CrInf: IMetabaseObjectCreateInfo;

Mb: IMetabase;

MbObj: IMetabaseObject;

Excel: IExcelDataset;

Begin

Mb:=MetabaseClass.Active;

CrInf := Mb.CreateCreateInfo;

CrInf.ClassId := MetabaseObjectClass.KE_CLASS_EXCEL_DS;

CrInf.Id := "Excel_DS";

CrInf.Name := "Excel_DS";

CrInf.Parent := Mb.Root;

Des := Mb.CreateObject(CrInf);

MbObj:=Des.Edit;

Excel:=MbObj.GetExtensionDispatch As IExcelDataset;

Excel.Path:="C:\data.xls";

Excel.DataSourceName:="Sheet1";

MbObj.Save;

End Sub Main;

After executing the example, the Data Source MS Excel object is created. The identifier of repository object is Excel_DS, an initial file is C:\data.xls, a data source is a sheet named Sheet1.

See also:

IExcelDataset