Assembly: Dt;
Namespace: Prognoz.Platform.Interop.Dt;
The IDtExcelProvider interface contains properties and methods of the Import from Excel(97-2003) data provider.
IDtExcelProvider
If in 64-bit operating system Foresight Analytics Platform with the capacity of 64 bit is installed, but Microsoft Office is not installed, then in order to work with the Microsoft Excel files using the interface and the Microsoft Access files it is required to install Microsoft Office with the capacity 64 bits.
NOTE. For correct import bitness of Foresight Analytics Platform must match with bitness of Microsoft Office.
One of the following providers is used on work: Microsoft.Jet.OLEDB.4.0 or Microsoft.ACE.OLEDB.12.0. Provider is selected automatically depending on the certain conditions:
Microsoft.Jet.OLEDB.4.0 is used if:
The work with XLS binary files (binary format of XLS files is used by earlier versions of Microsoft Office up to 2003 version).
Microsoft.ACE.OLEDB.12.0 is used if one of the following conditions is fulfilled:
The work is performed in x64 version of the platform.
The work is performed with XLS files in Office Open XML format.
The IDtExcelProvider.DriverVersion property contains Excel 12.0 version or later.
NOTE. On specifying the IDtExcelProvider.DriverVersion property the actual structure of the passed file is also checked (binary or Office Open XML). If the actual structure does not coincide with the Microsoft Office version corresponding to the driver, the used provider is automatically changed.
Depending on the value of the ImexMode property the mode is selected for importing data of various types. Values of the following registry keys are taken into account:
TypeGuessRows. The key determines number of the cells, that are used to determine data type (by default TypeGuessRows=8).
ImportMixedTypes. The key determines data type, to which all values are converted, if first cells contain data of different types (it is used in the DtExcelImexMode.Import mode).
Depending on the provider, the keys are used which are stored in different registry branches:
Microsoft.Jet.OLEDB.4.0. The keys are stored in the registry branch HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Jet\4.0\Engines\Excel\.
Microsoft.ACE.OLEDB.12.0. The keys are stored in the registry branch: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\<MS Office version>\Access Connectivity Engine\Engines\Excel.
It is impossible to specify the length of loaded fields' records on import. The field length is determined automatically by the first cells, also used to determine data type. If data type is determined as Text, and these cells have no values, which length is greater than 255 characters, all string values are loaded on import with restriction of 255 characters. To avoid trimming of records, set 0 value in the TypeGuessRows key, in this case data type determination and maximum length calculation is performed by all field's records.
To check file structure of the XLS format, see the example.
Property name | Brief description | |
The CheckFieldName property determines whether fields' names are transformed in such a way that number values can be imported. | ||
The DriverVersion property determines version of the driver used to work with the file. | ||
The File property determines the path and the name of the file, from which the data is imported. | ||
The HasHeader property determines whether fields header list is downloaded from the first file row. | ||
The ImexMode property determines the mode, in which import from the columns, that contain data of different types, is performed. | ||
The Query property determines Excel sheets query. |
Property name | Brief description | |
The AutoFillFieldsMode property determines the field type detection mode of the data provider. | ||
The CalcFieldsErrors property returns a collection of errors appeared on calculated fields calculation. | ||
The Eof property returns True if the cursor in the data source is on the last record. | ||
The FetchErrors property returns errors occurred on data import. | ||
The FilterIf property returns condition of loading of records from data provider. | ||
The StringDataFormat property returns settings used on data identification. | ||
The TypeGuessRows property determines number of rows by means of which the data type of each field will be determined. |
Property name | Brief description | |
The Active property returns data source or data consumer state. | ||
The Fields property returns data provider/data consumer fields description. | ||
The GetType property returns data provider/data consumer type. | ||
The Metabase property determines the repository, in which data is imported or exported. |
Method name | Brief description | |
The Fetch method reads data of the current entry from the data provider. | ||
The FetchRows method reads data of the specified number of entries from the data provider and returns the number of actually read entries. | ||
The ReadingRowsCount method returns the number of records read from the data source with taking into account loading condition. | ||
The ReadingRowsTotalCount method returns the number of records read from the data source without taking into account loading condition. |
Method name | Brief description | |
The ClearFields method clears fields list of the data provider or data consumer. | ||
The Close method closes data provider or data consumer. | ||
The FieldsFromFile method reads fields list from the source file. | ||
The Load method loads data source or data consumer parameters from XML. | ||
The Open method opens data provider or data consumer. | ||
The Save method saves data source or data consumer parameters in XML format. |
See also: