Import from Text
Importing data from a text file is similar to the import from a database. You must use other interfaces (described in steps 1 to 3 below) with different methods and properties:
1.Use a TextImportExportSettings object and set the properties: The method Application.GetTextImportExportSettings returns a new object to specify a text file for import: objImpSettings = objSpy.GetTextImportExportSettings(); You have to set at least the ImportFile property to the path of the file for the import. Another important property is HeaderRow. Set it to False if the text file does not contain a leading line as a header row: objImpSettings.ImportFile = strExampleFolder + "Tutorial\\Shapes.txt";
2.Call Application.GetTextImportElementList to get a collection of all columns inside the text file: objElementList = objSpy.GetTextImportElementList(objImpSettings);
3.Start the import with Application.ImportFromText: objImpDocFromText = objSpy.ImportFromText(objImpSettings,objElementList);
The JScript code listed above is available in the sample file ImportExport.js (see Example Files).