How to Save Statistica Spreadsheets as XML?

How to Save Statistica Spreadsheets as XML?

book

Article ID: KB0076402

calendar_today

Updated On:

Products Versions
Spotfire Statistica 13.5

Description

A wide variety of files are available in the Save as type box for Statistica Spreadsheet in the Desktop UI. Although the listed type for "Save As" option does not include the XML file, there are two other methods to save a Statistica spreadsheet as XML file:

1. Use the Export Node in a Workspace;
2. Use SVB code.  
 

Issue/Introduction

This article talks about how to write a spreadsheet to XML file in Statistica.

Resolution

1. Insert the  "Export Data Node " in a workspace, enter the full path and select "XML" as the File Type.

User-added image

2. Here below are SVB script examples of writing to XML. The path referred in the example macro needs to be replaced with the path where the XML file will be saved.
NOTE: The spreadsheet that is to be saved as xml has to be opened already and in active status before running the macro. 

--------------------------------------------------------------
Sub Main
    Dim ss As Spreadsheet
    Set ss = ActiveSpreadsheet
    Dim xmlData
    xmlData = ss.ContentData(scXMLVerbose)
    Dim iFileNo As Integer
    iFileNo = FreeFile
    Open "c:\users\yourname\desktop\test.xml" For Output As #iFileNo
    Print#iFileNo, xmlData
    Close #iFileNo
    'MsgBox xmlData
End Sub
--------------------------------------------------------------

Another example of using Spreadsheet.ExportXML() method:
--------------------------------------------------------------
Sub Main
    Dim ss As Spreadsheet
    Set ss = ActiveSpreadsheet
    Dim FileName
    FileName = "c:\users\yourname\desktop\test.xml"
    ss.ExportXML(FileName)
End Sub
--------------------------------------------------------------