Export to Text

www.altova.com Print this Topic Previous Page Up One Level Next page

Home >  Programmers' Reference > Application API > Overview > Programming Languages > JScript > Import and Export of Data >

Export to Text

To export data to text, carry out the steps below:

 

1.Use a TextImportExportSettings object and set the necessary properties.
2.Fill an ExportSettings object with the required values. See Item 2 in Export to database.
3.Build an element list with Document.GetExportElementList. See Item 3 in Export to database.
4.Call Document.ExportToText to execute the export.

 

objExpSettings = objSpy.GetExportSettings();
objExpSettings.ElementList = objImpDocFromText.GetExportElementList(objImpDocFromText.RootElement, objExpSettings);
 
objTextExp = objSpy.GetTextImportExportSettings();
objTextExp.HeaderRow = true;
objTextExp.DestinationFolder = "C:\\Temp";
 
try
{
 
      objImpDocFromText.ExportToText(objImpDocFromText.RootElement, objExpSettings, objTextExp);
}
catch(err)
{
  WScript.Echo("Error exporting to text.\n\n" +
                    "Error: " + (err.number & 0xffff) + "\n" +
                    "Description: " + err.description);
}

 

The JScript code listed above is available in the sample file ImportExport.js (see Example Files).


© 2019 Altova GmbH