CopySpecial Method (Python)

Copies selected items to the clipboard in a set of specified formats. Use this method with caution because it overwrites clipboard content. This method is especially useful when copying large pivot tables since you can limit the output to just the formats you need. In that regard, the Copy method generates output in all available formats.

To select individual items, use the SetSelected method. You can also select all items of a given type, such as all tables using the SelectAllTables method.

Syntax

SpssOutputDoc.CopySpecial(formats)

Table 1. Format specifications
Format Identifier Description
SpssClient.CopySpecialFormat.Text plain text
SpssClient.CopySpecialFormat.Rtf rich text format
SpssClient.CopySpecialFormat.Image image
SpssClient.CopySpecialFormat.Emf Windows enhanced metafile
SpssClient.CopySpecialFormat.Biff excel worksheet in biff5 format
  • The image format is a java raster image and is handled differently by different applications.
  • The Windows enhanced metafile (emf) format is only supported when selecting a single output item to copy to the clipboard.
    Table 2. Available formats for each output type
    Type Formats
    SpssClient.OutputItemType.CHART rich text, image or emf
    SpssClient.OutputItemType.LOG plain text, rich text or biff
    SpssClient.OutputItemType.MODEL image or emf
    SpssClient.OutputItemType.NOTE plain text, rich text, image, emf or biff
    SpssClient.OutputItemType.PAGETITLE plain text, rich text or biff
    SpssClient.OutputItemType.PIVOT plain text, rich text, image, emf or biff
    SpssClient.OutputItemType.TEXT plain text, rich text or biff
    SpssClient.OutputItemType.TITLE plain text, rich text or biff
    SpssClient.OutputItemType.TREEMODEL rich text or image
    SpssClient.OutputItemType.WARNING plain text, rich text, image, emf or biff
  • If a specified format is not supported for a selected item then the format is ignored for that item. For example, you select a Log item and a Chart item and specify the plain text and image formats. The clipboard contains the Log item in plain text format and the Chart item as an image.

Example

The following copies a pivot table to the clipboard in rich text format only.

SpssOutputDoc.CopySpecial([SpssClient.CopySpecialFormat.Rtf])