Altova XMLSpy 2025 Professional Edition

Method: ExportToText (pFromChild as XMLData, pExportSettings as ExportSettings, pTextSettings as TextImportExportSettings)

 

Description

ExportToText exports tabular information from the document starting at pFromChild into one or many text files. Columns of the resulting tables are generated in alphabetical order of the column header names. Use GetExportElementList to learn about the data that will be exported. The parameter pExportSettings defines the specifics for the export. Set the property ExportSettings.ElementList to the - possibly modified - list returned by GetExportElementList to avoid exporting all contained tables. The parameter pTextSettings defines the options specific to text export and import. You need to set the property TextImportExportSettings.DestinationFolder before you call ExportToText. UpdateXMLData() might be indirectly needed as you have to pass the XMLData as parameter to this function.

 

See also Import and export of data.

 

Errors

1400

The object is no longer valid.

1407

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

1416

Error during export.

1430

Document export failed.

 

 

Example

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

' VBA client code fragment - export document to text files

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

 Dim objDoc As Document

 Set objDoc = objSpy.ActiveDocument

 

 Dim objExpSettings As ExportSettings

 Set objExpSettings = objSpy.GetExportSettings

 objExpSettings.ElementList = objDoc.GetExportElementList(

                                                         objDoc.RootElement,

                                                         objExpSettings)

       

 Dim objTextExp As TextImportExportSettings

 Set objTextExp = objSpy.GetTextImportExportSettings

 objTextExp.HeaderRow = True

 objTextExp.DestinationFolder = "C:\Exports"

 

 On Error Resume Next

 objDoc.ExportToText objDoc.RootElement, objExpSettings, objTextExp

 

 If Err.Number <> 0 Then

         a = MsgBox("Error: " & (Err.Number - vbObjectError) & Chr(13) & "Description: "                                & Err.Description)

 End If

© 2018-2024 Altova GmbH