Altova XMLSpy 2024 Enterprise Edition

Application.GetTextImportElementList

Home Prev Top Next

Method: GetTextImportElementList(pImportSettings as TextImportExportSettings) as ElementList

 

Description

GetTextImportElementList retrieves importing information about the text-file as specified in pImportSettings. The function returns a collection of ElementListItems where the properties ElementListItem.Name contain the names of the fields found in the file. The values of remaining properties are undefined.

 

If the text-file does not contain a column header, set pImportSettings.HeaderRow to false. The resulting element list will contain general column names like 'Field1' and so on.

 

See also Import and export of data.

 

Errors

1111

The application object is no longer valid.

1100

Invalid parameter or invalid address for the return parameter was specified.

1107

Import from database failed.

1115

Error during text element list import. Cannot create parser for import file.

1116

Error during text element list import.

 

 

Example

' ---------------------------------------------------------

' VBA client code fragment - import selected fields from text file

' ---------------------------------------------------------

 Dim objImpSettings As TextImportExportSettings

 Set objImpSettings = objSpy.GetTextImportExportSettings

 

 objImpSettings.ImportFile = "C:\ImportMe.txt"

 objImpSettings.HeaderRow = False

 

 Dim objList As ElementList

 Set objList = objSpy.GetTextImportElementList(objImpSettings)

 

 'exclude first column

 objList.RemoveItem 1

 

 Dim objImpDoc As Document

 On Error Resume Next

 Set objImpDoc = objSpy.ImportFromText(objImpSettings, objList)

 CheckForError

© 2017-2023 Altova GmbH