TextBlock Class (R)

spss.TextBlock(name,content,outline). Creates and populates a text block item in the Viewer. The argument name is a string that specifies the name of this item in the outline pane of the Viewer. The argument content is a string that specifies the text, which may include the escape sequence \n to specify line breaks. You can also add lines using the append method. The optional argument outline is a string that specifies a title for this item that appears in the outline pane of the Viewer. The item for the text block itself will be placed one level deeper than the item for the outline title. If outline is omitted, the Viewer item for the text block will be placed one level deeper than the root item for the output containing the text block.

An instance of the TextBlock class can only be used within a StartProcedure-EndProcedure block.

Example

BEGIN PROGRAM R.
spsspkg.StartProcedure("mycompany.com.demo")
textBlock = spss.TextBlock("Text block name",
                           "A single line of text.")
spsspkg.EndProcedure()
END PROGRAM.
Figure 1. Sample text block
Sample text block
  • This example shows how to generate a text block within a StartProcedure-EndProcedure block. The output will be contained under an item named mycompany.com.demo in the outline pane of the Viewer.
  • The variable textBlock stores a reference to the instance of the text block object. You will need this object reference if you intend to append additional lines to the text block with the append method.