ExportDocument Method (Python)

Exports items from this output document.

  • If the items to be exported include charts, then they are exported in the last selected graphics format. The graph export type can be set from the SetExportOption method in the SpssClient class.
  • Use the SetOutputOptions method to set export options for export to Word, Excel, or PowerPoint.

Syntax

SpssOutputDoc.ExportDocument(subSet,fileName,format)

Parameters

subSet. Specifies whether all items, all visible items, or all selected items are exported. See available choices below.

fileName. Full path and file name for the file containing the exported items.

format. Specifies the export format. See available choices below.

On Windows, it is recommended to use raw strings for file paths, or replace backslashes with forward slashes (IBM® SPSS® Statistics accepts a forward slash for any backslash in a file specification). Raw strings are specified by prefacing the string with r, as in r'c:\examples\mydata.sav'. In raw mode, Python treats all backslashes in the string as the backslash character and not as the start of an escape sequence.

Table 1. Specifications for subsets
Value Description
SpssClient.SpssExportSubset.SpssSelected All selected items
SpssClient.SpssExportSubset.SpssVisible All visible items
SpssClient.SpssExportSubset.SpssAll All items
Table 2. Export formats
Format Description
SpssClient.DocExportFormat.SpssFormatHtml Html
SpssClient.DocExportFormat.SpssFormatDoc Word
SpssClient.DocExportFormat.SpssFormatXls Excel
SpssClient.DocExportFormat.SpssFormatXlsx Excel (xlsx)
SpssClient.DocExportFormat.SpssFormatText Text
SpssClient.DocExportFormat.SpssFormatPdf PDF
SpssClient.DocExportFormat.SpssFormatPpt PowerPoint