SpssOutputItem Class (Python)
The SpssOutputItem class represents any item in an output document. You get an SpssOutputItem object from an OutputItemList object.
Example: Exporting the First Pivot Table to HTML
import SpssClient
SpssClient.StartClient()
OutputDoc = SpssClient.GetDesignatedOutputDoc()
OutputItemList = OutputDoc.GetOutputItems()
for index in range(OutputItemList.Size()):
OutputItem = OutputItemList.GetItemAt(index)
if OutputItem.GetType() == SpssClient.OutputItemType.PIVOT:
OutputItem.ExportToDocument("/myfiles/mypivot",
SpssClient.DocExportFormat.SpssFormatHtml)
break
SpssClient.StopClient()
- SpssClient.GetDesignatedOutputDoc() gets an SpssOutputDoc object for the designated output document. In this example, the variable OutputDoc is an SpssOutputDoc object.
- The GetOutputItems method of an SpssOutputDoc object returns an OutputItemList object. In this example, the variable OutputItemList is an OutputItemList object.
- The for loop iterates through all of the objects in the OutputItemList object--one object for each item in the output document. On each iteration of the loop, the variable OutputItem is an SpssOutputItem object.
- The GetType method from the SpssOutputItem class returns the type of the output item. Pivot tables have an output item type of SpssClient.OutputItemType.PIVOT.
- You export the pivot table using the ExportToDocument method from the SpssOutputItem class.
- The break statement terminates the loop if a pivot table is found.