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 anSpssOutputDoc
object for the designated output document. In this example, the variable OutputDoc is anSpssOutputDoc
object. - The
GetOutputItems
method of anSpssOutputDoc
object returns anOutputItemList
object. In this example, the variable OutputItemList is anOutputItemList
object. - The
for
loop iterates through all of the objects in theOutputItemList
object--one object for each item in the output document. On each iteration of the loop, the variable OutputItem is anSpssOutputItem
object. - The
GetType
method from theSpssOutputItem
class returns the type of the output item. Pivot tables have an output item type ofSpssClient.OutputItemType.PIVOT
. - You export the pivot table using the
ExportToDocument
method from theSpssOutputItem
class. - The
break
statement terminates the loop if a pivot table is found.